Game Development Community

Scripting question: Objects bouncing into one another

by Entr0py · in Torque Game Engine · 09/14/2002 (6:07 pm) · 8 replies

Scripting Question:

How do I set up objects to bounce into one another?
(already having collision meshes).

Example: Player hits a barrel which bounces and hits another barrel knocking it over.

Example3: A bowling ball hitting a bowling pin which in turn hits other pins.

Thank in advance :)

#1
09/14/2002 (7:04 pm)
I'd like Example2 for $100, Alex.
LOL.. (ya missed one)

Sounds like a good Marble Madness question.
#2
09/15/2002 (9:02 am)
Doh hehe..
#3
09/17/2002 (1:33 pm)
Ok, I am assuming its not an easy task due to lack of responses :(
#4
09/17/2002 (1:46 pm)
Well, I haven't heard of anyone else trying this. If you have Tribes2 I'd suggest looking @ the flag. It can be shot at, thrown, etc.

Without looking further into it I couldn't tell you. :-(

I know Doyoon Kim's Grass demo would let you run into the people--the car would push the people. That may hold some clues.

Eric
#5
09/17/2002 (8:21 pm)
Hello? Anybody? Tim?
#6
09/26/2002 (3:03 pm)
Take a look in player.cs, look for the OnCollision event. Inside that event, you can determine what the player colided with (which should be %obj, IIRC), and from there take appropriate action, IE: set the player's velocity to nothing, and set the object's velocity to the player's previous velocity, setting it in motion. Granted, it gets a bit harder for collisions for non-square items (IE, the barrels) since you aren't always going to hit things head on, and have to figure how much force go transfered to the barrel, and at what angle the barrel should be traveling now, etc.

But that should be a really good start for ya to work from. Oddly enough, this gives me an idea... hm. Wonder what my art director is doing right now? (exec "evilgrin.cs")
#7
09/26/2002 (3:45 pm)
He's reading this post and wishing he hadn't. ;-)
#8
10/10/2002 (12:08 am)
Thanks for the help Davis :)