Game Development Community

AIplayer rotation

by Emile Van Hes · in General Discussion · 04/07/2008 (3:59 am) · 5 replies

Hello all!

I have a few simple characters in my game of the type StaticShape.
I can import them with the game editor, they all have some sequences and work fine just standing there.

but...
I want to select them in the game. But they don't have a collisionbox.
I think they need to be a differend class like - Player or AIplayer

When I do so (make them of the type Player and AIPlayer)
and start the game, they all face the same direction.......?
It is like the rotation is reset to 1,0,0

And also, I can't import them by the game editor anymore....
When doing this i get the Error message Player::create not found.

How is this possible?

Is there a way to import AIplayer or Players to the game with the Editor?
Or, is ther a way to make the NPC's of the type StaticShape and to give them an collisionbox?


Thanks a lot!

#1
04/07/2008 (4:13 am)
Fixed the problem with the Editor:

function PlayerData::create(%block)
{
%obj = new Player() {
dataBlock = %block;
};
return(%obj);
}
#2
04/07/2008 (4:20 am)
The reset problem of the orientation left.
#3
04/07/2008 (5:05 am)
You have to set the rotation as a quaternion, so

%obj = new Player() {
dataBlock = %block;
rotation = "0 0 1 180"; //180 degrees around z-axis
};
#4
04/07/2008 (6:35 am)
Do i have to write code for every player in the mission?

I think it is better to make them Shapebased.
But then i am unable to have collision detection on the charakters.


And if i make them of PlayerData, sometime the animation is messed up.
#5
04/07/2008 (8:35 am)
You could have the rotation as part of the function arguments, but you probably won't be able to use PlayerData::create() for that. We use spawn spheres and the AIPlayer::spawn() function takes the position and rotation of the spawn sphere to position the bot.

Have you looked at the AIGuard resource ?