whats does "physics on" mean?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

whats does "physics on" mean?

Post 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
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

func_fallingrock

Post 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.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

If you do physics_on on a script_object it'll also come down :)
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post 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.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

It will stop. In theory at least :). Oh I think it even bounces! :wink:
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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 .
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post 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:
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

self waittill touch

self physics_off
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

would that be like:
self waittill touch $player
self physics_off
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

thanks i think i can make the trap work good now :D
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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>
      }
}
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

yes that would work and then have the kill command after
Post Reply