Attract object to the camera
Forum » General / Help » Attract object to the camera
Started by: squidleonsquidleon
On: 1246529689|%e %b %Y, %H:%M %Z|agohover
Number of posts: 2
rss icon RSS: New posts
Attract object to the camera
squidleonsquidleon 1246529689|%e %b %Y, %H:%M %Z|agohover

Hi all,
I'm making weapon like hl2, I "send" ray to x and y of mouse and i return a objectcontroller (like mouse wheel example in jiglibx), How can I attract object to the camera or apply force for came object ?
Thanks all,
squidleon

last edited on 1246529713|%e %b %Y, %H:%M %Z|agohover by squidleon + show more
unfold Attract object to the camera by squidleonsquidleon, 1246529689|%e %b %Y, %H:%M %Z|agohover
Re: Attract object to the camera
nih (guest) 1246579546|%e %b %Y, %H:%M %Z|agohover

You need to add a world force to the object. This part is pretty easy, subtract the found object's location from a point just in front of the camera location and use that as your force. If you apply the difference each frame, the object will stop and hold at that point.

The tricky detail is that you need to add any forces from inside a PhysicsController object, during its update loop. Check the tutorials for an example.

unfold Re: Attract object to the camera by nih (guest), 1246579546|%e %b %Y, %H:%M %Z|agohover
New post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License