I saw a little trap on the Rjukan projects site and it has a block falling on the player and it falls with a command physics on. How does this work?
Does the block have to be completly suspended in the air without touching anything or how does it work. (I mean like there is 1 world unit on each side of the block or can it be touching something)
can anyone help?
/*QUAKED func_fallingrock (0.75 0.65 0.1) ? AUTO_RESET NO_RANDOMNESS REMOVE_ON_GROUND
Scorpios comments/information:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Description:
------------
Creates a rock that, when triggered, begins falling and bounces along a path
specified by targetname. Use info_waypoint for the path.
Values:
=======
"targetname" the path to follow.
"dmg" how much damage to cause creatures it hits (default 20).
"speed" how fast to move (default 200).
"wait" how long to wait before falling when triggered (default 0).
"noise" sound to play when rock touches the world
"start" Starts rock falling.
"bounce" sent to entity when touched.
AUTO_RESET - when done falling, automatically return to the start
NO_RANDOMNESS - don't use any randomness when making the rocks fall
REMOVE_ON_GROUND - remove the rocks when done.
******************************************************************************/
If you copy the text to Notepad, name it "rock.cpp" and put in a folder named "code" in main, you will see it in radient.
I know it bounces to stop it you have to turn physics off again but it will stop on it's own after a couple of high bounces . Also you can set gravity to control how fast it falls .
no don't think so touch is an event sent to an entity when it touches something . As far as I know you can't determine what it touched . You can try and glue a trigger to it and use the trigger to determine if it was triggered by a player possibly . The SDK has these
istouching( Entity entity )
returns 1 if the entities are touching, 0 if not
and
doTouch( Entity touchingEntity )
sent to entity when touched.
but not sure how to use the second one to get what entity is the touching entity