Is it possible to reshape bounding box dynamically
by Peter Dwyer · in Torque Game Builder · 03/03/2005 (3:03 am) · 7 replies
I have a character, that I want to present less of a target when he ducks, than when he is standing. For this I need the bounding box to be smaller when he is ducked down. The same applies to the enemies he will face.
How would I achieve this in T2D?
How would I achieve this in T2D?
#2
What I am currently doing is having the duck animation as part of the overall character animation frames. The scale seems to be about the center of the sprite, so my character still gets hit by bullets that should zing above his head.
Is there a way to resize so that the bounding box covers only the lower half of where it once did i.e. (forgive the character art)
+------+
| |
| |
| |
| |
| |
+------+
The above would be the standing box. Below is what I want the duck box to be like.
+------+
| |
| |
+------+
edit: er the spaces seem to have gone walkies!?!
03/03/2005 (3:18 am)
Thanks Philip.What I am currently doing is having the duck animation as part of the overall character animation frames. The scale seems to be about the center of the sprite, so my character still gets hit by bullets that should zing above his head.
Is there a way to resize so that the bounding box covers only the lower half of where it once did i.e. (forgive the character art)
+------+
| |
| |
| |
| |
| |
+------+
The above would be the standing box. Below is what I want the duck box to be like.
+------+
| |
| |
+------+
edit: er the spaces seem to have gone walkies!?!
#3
We'll be looking at per-frame collision-polygons at a later stage in T2Ds development. Way too much to do for now though.
- Melv.
03/03/2005 (3:24 am)
You can change the collision-polygon in realtime although I'd be careful doing this.We'll be looking at per-frame collision-polygons at a later stage in T2Ds development. Way too much to do for now though.
- Melv.
#4
Have you tried .setCollisionPolyCustom on the fly? You could then set it each time your player changes state from standing to ducking.
03/03/2005 (3:25 am)
Right, I'm with you.Have you tried .setCollisionPolyCustom on the fly? You could then set it each time your player changes state from standing to ducking.
#5
03/03/2005 (3:34 am)
Great thanks Philip and Melv.
#6
03/03/2005 (3:38 am)
Great thanks Philip and Melv.
#7
03/03/2005 (9:10 am)
Quote:We'll be looking at per-frame collision-polygons at a later stage in T2Ds development.Mmmmmmm. I'll be needing that tasty morsel for my next game.
Torque Owner Philip Mansfield
Default Studio Name
Otherwise you could maybe use:
$player.setCollisionScale("xscale yscale");Where xscale and yscale would be the amount to shrink the bounding box by (values between 0 and 1).