mouse click cannot select the right shape



Users browsing this forum: No registered users and 4 guests

Next topic
Previous topic
Post new topic Reply to topic  NeoAxis Forum Index » General » Help
Search for:
Author Message

Joined: Sat Jun 27, 2015
Posts: 1
PostPosted: Fri Jan 13, 2017 8:37 am Post subject: mouse click cannot select the right shape
Reply with quote Bottom of Page Back to top
There is a cabinet on the map. It can be opened and closed.
open.png

close1.png

close2.png


My question is why cannot close the door in both picture? My physical model show below.
phy.png

phy2.png



Code: Select all   Expand view
public MousePickingResult PickObjectBy(Vec2 screenPosition)
        {
            Ray ray = RendererWorld.Instance.DefaultCamera.GetCameraToViewportRay(screenPosition);
            if (!float.IsNaN(ray.Direction.X))
            {
                RayCastResult result = PhysicsWorld.Instance.RayCast(ray, (int)ContactGroup.CastOnlyContact);// Cannot get the right shape in second pciture.
               
                if (result.Shape != null)
                {
                    MapObject objectPicked = MapSystemWorld.GetMapObjectByBody(result.Shape.Body);
                    Vec3 objectPosition = result.Position;
                    MousePickingResult r = new MousePickingResult(true, objectPicked, objectPosition);
                    return r;
                }
            }
            return MousePickingResult.NOT_FOUND;
        }

 
 Profile  

Joined: Wed Nov 14, 2007
Posts: 2280
PostPosted: Fri Feb 10, 2017 9:52 am 
Reply with quote Bottom of Page Back to top
This is what I think is happening. When you are clicking on the door you are sending a RayCast from the 2D mouse location on the screen to the 3D environment. You have a physics surface on the door that is hit by the RayCast and the door opens. Now there is no physics surface on the other side of the door. I can't remember if those surfaces are 2 sided or not, but adding another surface on the inside of the door would solve this. The demo doors must also have something like this, so I would check the Demo and its code

_________________
http://games.kipase.com/
 
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  NeoAxis Forum Index » General » Help

Jump to:  

Next topic
Previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron

All times are UTC




Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group