Search code examples
objectpositionnvidiaphysx

Find the position of an object in PhysX at run time


I am trying to spawn a ball in the world dependant on where the player (box) is at the time. to do this i need to know the position of the box and when i press a button the ball shall appear in the center of the top face of the box.

So for this i would need to be able the Y axis of the position also, and after searching online i cant find anything for help.

Anyone know how to help me with this?

Thank you.


Solution

  • It's very difficult to give you an accurate answer without any code.

    However something along these lines is what you are aiming for:

    NxVec3 ballSpawn = box.getGlobalPosition();
    ball.setGlobalPosition(NxVec3(ballSpawn.x, ballSpawn.y+boxHeight, ballSpawn.z));
    

    The PhysX SDK Documentation has an excellent search function for the basics.