Game Development Community

AI Bounds Transforms

by addict^2 · in Torque 3D Professional · 03/02/2011 (4:52 pm) · 13 replies

Hello,

I'm having an issue transforming an AIPlayer's bounding box when they rotate along their paths, as in the box doesn't rotate. I think for a normal, thin, player this isn't an issue but I'm using a truck. I noticed that getAIMove does the transformation for the player whenever moveDestination is modified, but how would I access the bounding box, and what I need to do to ensure that it gets transformed correctly.

Much Thanks

#1
03/24/2011 (6:25 pm)
So after spending a little time away from this issue I've gone back to tackling it. It seems that my initial assumption with getAIMove may be incorrect as the function does nothing to the bounding box. Looking into player's _move and updateMove, I don't see where the bounding box is being translated where I could try to rotate the box based on the eye transform.
#2
03/24/2011 (6:51 pm)
Bounds is orientated from world transform not object transform. The only time bounds gets updated is when the player changes pose (eg: crouch), so that's where the only stock code on making any alterations to bounds will be.
#3
03/25/2011 (2:00 am)
So would you suggest that I use the same code from that section within _move or updateMove?
#4
03/25/2011 (2:11 am)
I should clarify this issue some more. At the heart of the problem is player-player collision, in this case a Player class object colliding with an AIplayer class object. The AIplayer object is a truck that is following a rectangular path, and I'm trying to script some collision logic with the Player object. The problem is that the bounding box on the truck, which I am 95% sure at this point is what is colliding with the player, doesn't rotate with the truck, and as the truck is much longer than it is wide problems arise along one axis.

If I script the Player's oncollision callback to look for the truck, will I be able to use the truck's collision mesh instead? And will that collision mesh rotate correctly?
#5
03/25/2011 (7:41 am)
This is strange - what software are you using to create your models? If it's Max, perhaps double-check the link properties - by default all linked geometry inherits all translations and transforms of the parent object inside of Max but this can be turned off for each axis in the motion control panel.

I am completely unfamiliar with any other modeling software, but there's my only thought on the matter. The DTS code is the only other place I can think to look - the whole system should be self-contained and all actor geometry should just handle itself within the sim. <Shrug>
#6
03/25/2011 (8:57 am)
If you're using a truck then why not use a vehicle?
#7
03/25/2011 (12:29 pm)
Sure, but does the bb for a vehicle rotate properly? I'm beginning to wonder if the pseudo-location for hit location on players is actually working properly - I mean, if the bb doesn't rotate properly how can you tell if you've hit the front or back of the player?

Addict, I think the collision mesh should work fine - but you might need to make a square block for the bounds on the truck so that it properly contains the truck model no matter which way it faces. I'm not sure, though. Basically the bb may just be sort of a pre-collision criteria anyway - the engine should use the collision mesh for actual collisions.

Of course, this is just speculation - I may not have a proper grasp of the systems in question.
#8
03/25/2011 (12:29 pm)
@Steve
At first I tried using the AIWheeledVehicle class from this resource:

http://www.garagegames.com/community/resources/view/16451/1

I found that Torque's car physics when it came to navigating narrow, 90 degree angled paths was bad.


@Richard
I am using Maya.
#9
03/25/2011 (12:31 pm)
@Richard
Can you explain your understanding of the purpose of the bounding box versus the collision mesh. My assumption right now is that the box is used for an object's check against other collision meshes.
#10
03/25/2011 (5:40 pm)
The way I understood it, the bounding box is used for checking projectile and object collisions against the Player, and collision meshes were used for vehicles and other objects. For other objects the bounding box should be used for collision culling, i.e. if it doesn't hit the bounding box then skip the detailed check for which collision mesh it might have hit (there can be many collision meshes per object - 16 or 19 or some such?).

Of course, again, I might have misunderstood the way the system works.
#11
03/26/2011 (6:29 am)
What if the Player was a car? It looks like I will have to fiddle with either changing the AIVehicle class and gutting its physics, probably end up with some hybrid player vehicle.
#12
03/26/2011 (8:43 am)
Well, you could have the player drive a car that has no visible geometry....
#13
03/26/2011 (5:30 pm)
Thanks will give that try!