Jump to content
  • Advertisement
Sign in to follow this  
m_cio

physx beginner: keep camera position constant relative to an object

This topic is 3171 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

nvidia physx: i have an "actor" and the camera. i get the "actor" position: Nxvec3 = actorPos; actorPos = actor->getGlobalPosition() ..... and set the position of the camera on: gCameraPos = actorPos + NxVec3(0,0,-2); ..... but this position remain only on first frame. How i make the camera keep ALL THE time this position relative to the "actor"

Share this post


Link to post
Share on other sites
Advertisement
this is what i ask..
how i update the camera position on every frame to "actor" position (or other moving actor)...

i mean.. i need for some simple lines of codes examples which could be (for advanced ones) easy or obvious...
i am to level were i experience put some objects on scene on some coord, move ahead , move back..., change settings, change functions, arguments, update camera coordonates after diferent actors...etc ..hundreds of things like this...

Share this post


Link to post
Share on other sites
i don't know...it is imposibe ?
i use to work with havok in shockwave and the nine words of code for this , in lingo, was:

on enterframe me
cam.worldposition=object.worldposition
end

..and was one of the first thing which you learn on EVERY tutorial from net ...
because was one of the essential things you should work with in characters scene buildings....: the "attach" camera from a moving actor.
it is so hard in nvidia c++ physx to do this?
or imposible...?
so that NOBODY could give me a minimal sugestion.....

Share this post


Link to post
Share on other sites
m_cio, Zahlman gave great advice. If that code works for one frame, there is no reason why it wouldn't work for every frame. You need to make sure that the code is executed every single frame.

If you are a making a game, you probably have some sort of game loop. Put this code in the game loop (ideally in some abstracted way to work with any actor you want to attach the camera to).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!