Page 1 of 1

whats does "physics on" mean?

Posted: Mon Jul 02, 2007 12:03 am
by erick
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? :D

func_fallingrock

Posted: Mon Jul 02, 2007 3:38 am
by tltrude
It is probably a func_fallingrock. I never could get it to follow a path.

Code: Select all

/*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.

Posted: Mon Jul 02, 2007 8:20 am
by jv_map
If you do physics_on on a script_object it'll also come down :)

Posted: Mon Jul 02, 2007 3:41 pm
by erick
on a script object will it crash through the ground and keep on going or will it stop when it hits the ground.

Posted: Tue Jul 03, 2007 1:40 pm
by jv_map
It will stop. In theory at least :). Oh I think it even bounces! :wink:

Posted: Tue Jul 03, 2007 1:47 pm
by bdbodger
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 .

Posted: Tue Jul 03, 2007 9:07 pm
by erick
is there a way to stop it when it hits a script orgin or a trigger :?:
I dont want the bouncing rocks :wink:

Posted: Wed Jul 04, 2007 6:30 am
by bdbodger
self waittill touch

self physics_off

Posted: Wed Jul 04, 2007 5:20 pm
by erick
would that be like:
self waittill touch $player
self physics_off

Posted: Wed Jul 04, 2007 6:54 pm
by bdbodger
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

Posted: Wed Jul 04, 2007 7:40 pm
by erick
thanks i think i can make the trap work good now :D

Posted: Wed Jul 04, 2007 7:51 pm
by bdbodger
I think the first one would work

Code: Select all

self waittill touch

for(local.i=1;local.i<=$player.size;local.i++)
{
     if( istouching( self $player[local.i] ) )
     {
                   self physics_off

                   <your stuff here>
      }
}

Posted: Wed Jul 04, 2007 7:59 pm
by erick
yes that would work and then have the kill command after