Issues Animating Player Collision Mesh (LOS?)
by Michael Stoll · in Torque 3D Professional · 05/24/2014 (4:19 pm) · 31 replies
A recent inclusion for our in-development game requires the player to possess a set of collision meshes that would animate to update with the model. We need precision with our collisions, so we've been looking into and researching this for a couple days now.
I set up the model hierarchy with a basic test model; two cubes animated using two rotating bones. One goes up, the other goes right, and each cube has it's own collision-#, col-#, LOS-#, and LOScol-# meshes to go along with it, as well as the typical base01, start01 hierarchy stuff that I could gather from my extension searches. Most, if not all, of the information I found was probably out of date, but it still... sort of worked in game. Static collision shapes work fine, but when animated the meshes do not follow them, so we tried it with the player and the same situation arises, except sometimes the LoS check doesn't collide with the cubes at all.
Overall this seems like kind of a mess and I wish there was more information available regarding the topic. We would appreciate any help you could provide.
Thanks,
Mike
I set up the model hierarchy with a basic test model; two cubes animated using two rotating bones. One goes up, the other goes right, and each cube has it's own collision-#, col-#, LOS-#, and LOScol-# meshes to go along with it, as well as the typical base01, start01 hierarchy stuff that I could gather from my extension searches. Most, if not all, of the information I found was probably out of date, but it still... sort of worked in game. Static collision shapes work fine, but when animated the meshes do not follow them, so we tried it with the player and the same situation arises, except sometimes the LoS check doesn't collide with the cubes at all.
Overall this seems like kind of a mess and I wish there was more information available regarding the topic. We would appreciate any help you could provide.
Thanks,
Mike
#2
05/24/2014 (7:23 pm)
Am I to understand that there is /no way/ to animate collision meshes, even when the object trying to animate the collision meshes is a player?
#3
If it's the latter, well, good luck :P. I tried that back in the TGE days. It was not a fun adventure, let me tell you. The engine is too mired in Tribes heritage to support that without rewriting Player's physics entirely.
05/24/2014 (8:14 pm)
Are you using these collision meshes for projectile collisions, or actual physics? If the former, check this out - Az has ported one of the hitbox resources to latest T3D, and it may be just what you're looking for. We're not merging it just yet (though we will make a decision on it before 3.6), but you can pull it into your own code base of course.If it's the latter, well, good luck :P. I tried that back in the TGE days. It was not a fun adventure, let me tell you. The engine is too mired in Tribes heritage to support that without rewriting Player's physics entirely.
#4
05/24/2014 (9:43 pm)
That looks very helpful, Daniel. We'll look into that for sure. :) Thanks.
#5

Still using the HB## instead of hitbox## tag this end, but example hierarchy shot using altered material settings (hitboxes visible, and normal ones not instead of the other way around) for review.
05/25/2014 (11:14 am)

Still using the HB## instead of hitbox## tag this end, but example hierarchy shot using altered material settings (hitboxes visible, and normal ones not instead of the other way around) for review.
#6
If it looks weird, it's because it is. I'm honestly out of ideas after nearly 8 hours of straight work today.
Here's a brief explanation of the video; we color coded the hitboxes on the model and did a quick walk around. As you can see, the collision works, as the green hp bar appears when looking at the boxes, but they're obviously not in the right places. This conclusively is NOT an issue with Azaezel's code, but is instead something wrong either with what I've done to the model or with blenders export or torques import.
I'd like whatever help anyone could provide. Here's a screenshot of my object hierarchy in blender.
i.imgur.com/AJKDaZ0.png
05/25/2014 (5:09 pm)
So... here's how far we've gotten. videobam.com/lveQaIf it looks weird, it's because it is. I'm honestly out of ideas after nearly 8 hours of straight work today.
Here's a brief explanation of the video; we color coded the hitboxes on the model and did a quick walk around. As you can see, the collision works, as the green hp bar appears when looking at the boxes, but they're obviously not in the right places. This conclusively is NOT an issue with Azaezel's code, but is instead something wrong either with what I've done to the model or with blenders export or torques import.
I'd like whatever help anyone could provide. Here's a screenshot of my object hierarchy in blender.
i.imgur.com/AJKDaZ0.png
#7
05/25/2014 (8:09 pm)
Did you make them children of each bone or actually attempted to skin them to the bone?
#8
Thanks,
Mike
05/25/2014 (8:20 pm)
Children. If I skin them using Weight Painting, they appear in the correct location, but do not function as hitboxes ingame. As you can see, none of the hitboxes have any vertex groups, and so are not affected by any sort of "weight paint" animating, and only follow the bones. It looks and works correctly in blender, but something goes wrong when I import to torque.Thanks,
Mike
#9
Still, mind humoring me to make sure on that hierarchy with an in-object-editor shot?
05/25/2014 (10:44 pm)
The only thing we can think of that might be different that might cause something like that is perhaps the animations lacking the meshes (Mismatched meshes between animation and model they're applied to can cause muchas wonkiness, since anims are after all sequences of transforms.)Still, mind humoring me to make sure on that hierarchy with an in-object-editor shot?
#10
It's a bit long...
We also used a simpler model earlier (2 animated cubes with 2 rotating bones) and it resulting in similar problems, if a little bit more organized... but only because it was on one axis for one of the cubes- seems any movement on the Z axis ruined everything, and one was upside down, and under the ground.... it was a mess.
As for the first part of your reply I'm a bit embarrassed to say I'm not sure I understand what you mean.
05/25/2014 (11:08 pm)
i.imgur.com/fLR8eFW.pngIt's a bit long...
We also used a simpler model earlier (2 animated cubes with 2 rotating bones) and it resulting in similar problems, if a little bit more organized... but only because it was on one axis for one of the cubes- seems any movement on the Z axis ruined everything, and one was upside down, and under the ground.... it was a mess.
As for the first part of your reply I'm a bit embarrassed to say I'm not sure I understand what you mean.
#11
To further clarify the first part: Do you have an identical hierarchy for your dsq/.dae's referenced in your animation entries as you do the base model, or were the collision meshes added on after? Mismatches can distort which sub-object is being moved what direction.
05/25/2014 (11:19 pm)
Ok, hierarchy looks correct. To further clarify the first part: Do you have an identical hierarchy for your dsq/.dae's referenced in your animation entries as you do the base model, or were the collision meshes added on after? Mismatches can distort which sub-object is being moved what direction.
#12
05/25/2014 (11:31 pm)
Animations are contained within the DAE. We have no seperate files besides that. We just use the default blender settings for exporting DAE's... are we missing something? Some sort of tool that has a "Make the model actually make sense" checkbox on it?
#13
Drew above uses max, and he's our rigger, so haven't really done much by way of blender animations, though looking at blender my end, I do note there's an Export for OpenSim option under Armature Options that I seem to recollect reading about in one of the threads around here... though why that wouldn't also be needed for your weighted meshes escapes me if that works...
05/25/2014 (11:53 pm)
That is well and truly puzzling. (And the irritation is contagious.)Drew above uses max, and he's our rigger, so haven't really done much by way of blender animations, though looking at blender my end, I do note there's an Export for OpenSim option under Armature Options that I seem to recollect reading about in one of the threads around here... though why that wouldn't also be needed for your weighted meshes escapes me if that works...
#14
I used the OpenSim for Rigged since you mentioned it, and it's.. well, it's upright now, at least. Now the only issue is that for some reason it seems to all be scaled... out. :\ Very strange. I haven't even touched any sort of scaling in blender.
05/26/2014 (12:07 am)
Update! http://i.imgur.com/55L4R13.pngI used the OpenSim for Rigged since you mentioned it, and it's.. well, it's upright now, at least. Now the only issue is that for some reason it seems to all be scaled... out. :\ Very strange. I haven't even touched any sort of scaling in blender.
#15
Try Object > Apply > Location/Rotation/Scale (shortcut Ctrl + A).
You may or may not have to remove em from their parents, clear the transforms, and re-parent em. That bit I forget.
05/26/2014 (5:21 pm)
OK, *think* it's a hierarchical transform inheritance problem. They crop up from time to time no matter how careful you are (Or I'm just that bad a modeler when it comes to the programmer 'art' end of things.)Try Object > Apply > Location/Rotation/Scale (shortcut Ctrl + A).
You may or may not have to remove em from their parents, clear the transforms, and re-parent em. That bit I forget.
#16
05/26/2014 (6:14 pm)
Well, I tried that in Blender and it didn't have any visual effect. I unparented it and tried it and still nothing, so I reparented and imported to torque to see what it would do and it seems to have broken the animations and brought the hitboxes back to how broken they were before haha
#17
05/26/2014 (6:59 pm)
Ctrl+A doesn't usually have a visual effect, IIRC!
#18
Simple steps would be greatly appreciated :D thank you again,
Mike
05/26/2014 (7:05 pm)
Any advice on using it to fix the model, then? I'm a bit lost. I'm far from a professional artist and finding tutorials for this stuff is pretty much impossible. Simple steps would be greatly appreciated :D thank you again,
Mike
#19
05/29/2014 (1:53 pm)
Not really sure what to tell you at this point, except keep trying combinations of resetting the relative transforms for the parent/child relationships in a step by step manner starting with cleansing the armature its-self to clear any lurking garbage data.
#20
Creation of Hitboxes:
1) Create as many cubes as you'll need for the hitboxes
2) Place them IN OBJECT MODE such that the origin of the unmodified cubes are centered on the TAIL of the bone you want to set as a parent.
(Torque recognizes only the 'Tail' as the bone!!)
3) Go into edit mode to change each hitbox to look like what you want it to look like.
4) Select all of the hitboxes in Object mode and set their location to 0 0 0
5) Set the hitboxes as children to the parentbone you had in mind using Bone Relative.
6) export using OpenSim Rigged
Notes: this won't look right in blender, but will work perfectly in torque.
All of the hitboxes will be gathered underneath the model in a clump, so building them with object mode for ease of construction is merely a 'good idea' and not actually required.
05/29/2014 (5:18 pm)
Well after way, way too much time sunk into figuring it out and researching it (and even opening up dae files with xml, or something...) I put this list together in case anyone in the future has the same issue.Creation of Hitboxes:
1) Create as many cubes as you'll need for the hitboxes
2) Place them IN OBJECT MODE such that the origin of the unmodified cubes are centered on the TAIL of the bone you want to set as a parent.
(Torque recognizes only the 'Tail' as the bone!!)
3) Go into edit mode to change each hitbox to look like what you want it to look like.
4) Select all of the hitboxes in Object mode and set their location to 0 0 0
5) Set the hitboxes as children to the parentbone you had in mind using Bone Relative.
6) export using OpenSim Rigged
Notes: this won't look right in blender, but will work perfectly in torque.
All of the hitboxes will be gathered underneath the model in a clump, so building them with object mode for ease of construction is merely a 'good idea' and not actually required.
Chris DeBoy