Game Development Community

Geting the player to face a direction

by Tom Perry · in Torque Game Engine · 01/29/2006 (8:02 am) · 6 replies

Is there a method or way to get the player to face a certain direction? I am using the orbit cam mode (from the advanced camera resource) and i would like the player to face towards the enemy but I can't find a way to make him do that!
Any help would be appreciated.

#1
01/29/2006 (8:14 am)
In the RPG-Editor ressource the NPC's face the player upon 'contact'.

I think that a scan through that code, will give you what you need.
#2
01/29/2006 (8:15 am)
Ok thanks a lot, I'll try that out.

edit: I have yet to DL the rpg dialog editer resource (I assume thats the one you ment) but thinking about it if it is the NPC that turns towards the player then that isn't what I want. I can get the AIPlayers to face the way I want with aimAtObject (or somthing similar) I think, but that won't work for the Player. I'll give the RPG code a look through when I can DL it but I am not sure that it is what I am looking for.
#3
01/29/2006 (11:21 am)
Player currently doesnt have the functionality without doing the math outside the class.

you can either grab the turn to destination from aiplayer.
or homeroll your own better solution.
#4
01/29/2006 (11:24 am)
Ok, thanks badguy. Thats what I thought, I guess I will have a dig in the source. If anyone can think of an easier solution that would be great, my C++ skills are basically non existant, but I will have a crack...we learn by doing right? :)
#5
01/30/2006 (6:06 am)
If you can get the bearing of the enemy relative to your player, you can use my rotateShape resource to rotate your player in script. Take a look at:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9480
#6
01/30/2006 (8:23 am)
That might be just the ticket. When I have some free time (free time? whats that? :P) I will check it out. Thanks Tim.