Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  

Move 3D Object With Mouse (Physics Gun)

This topic is 2842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone! Im trying to figure out some math for creating a simple Physics Gun. I plan on having a First Person View, with the ability to move in all directions and to be able to rotate the Camera. I am currently very very puzzled on how i would go about this. This is what ive learned so far. First i must perform a ray cast. I need the start position (the player/camera) and the end position(The object i am trying to manipulate). After i have those two things i am very confused as what i do. I want to be able have a working physics gun like in garrysmod. So the objecct will move when i move and it will move when i rotate the camera. I did some reading and found, that if you subtract the objects position from the start position, then add that difference to the objects position it will accomplish what i am trying to do. Is this correct?

Also would this work? http://ode-wiki.org/wiki/index.php?title=HOWTO_gravity_gun

Doing (camera positon + camera direction) - targetposition and then using that as a velocity?

Thank you everyone for looking!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!