I want my player’s head to look at the mouse cursor, like in Super Mario 64.
“Looking and Gripping” sample has an example for that, but it seems to be a hardcoded values which just happen to make things look kind of correct.
Plus my character is moving in 3d space with the camera.
This is my code. Do you need it?
def task(self, task):
self.world.doPhysics(globalClock.getDt(), 10, 1.0/160)
if self.key['mouse']: # Determine whether the mouse is pressed
If you want use the code, you have to keep that camera’s focus on the player always.
oh … I forgot it:
If the above doesn’t suit your purposes:
You should be able to get the appropriate point using a ray-cast, as shown here.
On the other hand, if your set of potential points is confined to a plane – if, for example, you only want to pick “floor positions” on a perfectly flat floor with no steps or other changes in height – you might find this quicker method more useful.