Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Vector3 Question
PostPosted: Tue Jan 22, 2008 7:54 pm 
Offline

Joined: Wed Jan 16, 2008 10:48 pm
Posts: 4
Hello, on mouse move I am calculating the old mouse position vector3 and the new mouse position vector3. I want to then take those two values and get a new Vector3 of where the object should go based upon those two values. I am currently using the Vector3.Add method but that is clearly the wrong approach. Can anyone help? Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Vector3 Question
PostPosted: Wed Jan 23, 2008 12:48 am 
Offline

Joined: Wed Jan 16, 2008 10:48 pm
Posts: 4
I am trying this in a PhysicsWorld with gravity on Z:

Vector3 newVector3Pos = pp.Pos2DToPos3D((int)newMousePos.X, (int)newMousePos.Y);
newVector3Pos.Normalize();
newVector3Pos *= 7.0f;
Vector3 relPos = newVector3Pos - pb.Body.CenterOfMassPosition;
relPos.Normalize();

pb.Body.ApplyImpulse(newVector3Pos, relPos);

the results are funky but it is moving. Not in the direction my mouse is moving. Any help would be greatly appreciated as I am REALLY NEW to Bullet. Thanks!


Top
 Profile  
 
 Post subject: Re: Vector3 Question
PostPosted: Wed Jan 23, 2008 1:06 am 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3744
Location: California, USA
Is this really Bullet C++ version?

It looks more like a port or other physics engine. Where is this 'Pos2DToPos3D' method implemented?

Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: Vector3 Question
PostPosted: Wed Jan 23, 2008 6:43 pm 
Offline

Joined: Wed Jan 16, 2008 10:48 pm
Posts: 4
Good point, I should have mentioned, this is the C# port and Pos2dToPos3D is just the ReyTo method refactored. So it just takes a point and returns a point in 3D space, if I am correct.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group