Game Development Community

How to animate an object on impact?

by Dave Calabrese · in Torque Game Engine Advanced · 01/08/2008 (11:30 am) · 4 replies

I have a bit of foliage that I want to make rustle about whenever the player comes in contact with it. I've modeled up the foliage in MAX, gave it a quick 'rustle' animation, and popped it into my game. Now I'm trying to work out how to make this animation toggle whenever the player touches the object. I looked into using triggers, however those look like they only work on a client/server basis and I worry that could become expensive on the network (a player passes through 20 flowers, 20 network calls to all players - no good). So I don't need these to be network based, only local.

So my question, simply enough, is...

How do I make an object animate when the player comes in contact with it for the client only without getting the server involved?

Thanks,
-Dave C.
21-6 Productions

#1
01/08/2008 (11:39 am)
OnCollision might work.
#2
01/24/2008 (8:04 am)
Why don't you just hook up PhysX, then the physics would handle this for you.
#3
01/24/2008 (8:41 am)
Mb: OnCollision works great, however also causes the object to bounce off the foliage rather than going through it.

Timothy: As awesome as that would be, PhysX isn't needed for this project (plus we're almost done, so adding PhysX at this point would be like baking a chocolate cake then while you're frosting it say, "Hey, let's make it vanilla!").

Seriously though, PhysX rocks and I can't wait to get to use it again. =)

- Dave C.
21-6 Productions
#4
03/17/2008 (8:23 am)
I'm pretty sure using the ::onCollision function does not require you to enable physical collision. When our player is in contact with a weapon, onCollision is called and we use it to cause a script event that asks you if you want to pick up/swap said weapon, however it doesn't physically collide with the player or projectiles. But I haven't done anything with foliage and onCollision yet.