Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Very Basic Physics #31417
07/30/04 02:57
07/30/04 02:57
Joined: Jul 2004
Posts: 18
C
coma Offline OP
Newbie
coma  Offline OP
Newbie
C

Joined: Jul 2004
Posts: 18
can anyone help.
i can not find anywhere a basic coding showing with comments
how you make basic physics objects.
what i am trying to do is attach 2 blocks and add an hinge
i need to know the very basic off setting each object the world physics

if anyone could help
i would be gratefull.

thanks CoCo

Re: Very Basic Physics [Re: coma] #31418
07/30/04 04:47
07/30/04 04:47
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
Code:

ENTITY* pObject1;
var hHinge;
action Object1
{
phent_settype(my, PH_RIGID, PH_SPHERE); //make physics entity
pObject1= my; // store for later reference
}
action Object2
{
while (pObject1==0) { wait(1); } // wait until object1 is ready....
phent_settype(my, PH_RIGID, PH_SPHERE); //make physics entity
hHinge= phcon_add(PH_HINGE, pObject1, my ); // join the two and store handle
ph_setgravity( vector(0,0,-400) ); // activate gravity
}



Now create a level with two models in it and assign action Object1 to one of them and Object2 to the other. Once you got that working read the manual on constraints and how to set up the details.

Re: Very Basic Physics [Re: Marco_Grubert] #31419
07/30/04 05:38
07/30/04 05:38
Joined: Jul 2004
Posts: 18
C
coma Offline OP
Newbie
coma  Offline OP
Newbie
C

Joined: Jul 2004
Posts: 18
is there anyway that you can join the objects in a certain place
for e.e

top left on 1 object
& bottom right on another 1

Re: Very Basic Physics [Re: coma] #31420
07/30/04 05:50
07/30/04 05:50
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
No, they are always joined at their center of gravity.

Re: Very Basic Physics [Re: Marco_Grubert] #31421
07/31/04 00:48
07/31/04 00:48
Joined: Jul 2004
Posts: 18
C
coma Offline OP
Newbie
coma  Offline OP
Newbie
C

Joined: Jul 2004
Posts: 18
thanks 4 your help

Re: Very Basic Physics & Collide [Re: coma] #31422
08/01/04 04:07
08/01/04 04:07
Joined: Jul 2004
Posts: 18
C
coma Offline OP
Newbie
coma  Offline OP
Newbie
C

Joined: Jul 2004
Posts: 18
with this script below the balls bounce around but how could a call an event when the balls collide with a certain object in the level
thanks coma


////////////////////////////////////////////////////////////////////////////////////

var video_mode = 8; // 800x600 pixels
var video_depth = 32; // 32 bit mode

////////////////////////////////////////////////////////////////////////////////////

string mypro_wmb = <mypro.wmb>;
string box_mdl = <ball.mdl>;

////////////////////////////////////////////////////////////////////////////////////

var box_pos;

function makebox();
function create_box();

entity* box_ptr;



//x = random(2)-1; // x is set to a number between -1.0 and 0.999999


function main()
{
level_load (mypro_wmb);
wait(3);
camera.x = 0;
camera.y = -600;
camera.z = 240;
camera.pan = 90;
camera.tilt = -15;

box_pos.x = random(25)-25; // initial value, ranges from -95 to 105
box_pos.y = -71;
box_pos.z = 295;

}

function makebox()
{
box_pos.x = random(25)-25; // initial value, ranges from -95 to 105
box_pos.y = random(71)-71;
box_pos.z = 495;

box_ptr = ent_create(box_mdl, box_pos,create_box);
wait(1);
}


function create_box()
{
phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball
phent_setmass(my, 1, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere
phent_setfriction(my, 50); // friction
phent_setelasticity(my, 99, 0); // bounce a little
temp.x = 0;
temp.y = 0;
temp.z = -380; // earth gravity factor, g = 9.81 m/s2
ph_SetGravity(vector(0,0,-50 0)); // set gravity
while (my.z > -50) {wait (1);} // the ball has approached the floor
// sleep (1); // give it 3 more seconds
phent_setelasticity(my, 5, 0); // stop bouncing
phent_setmass(my, 10, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere
sleep (15); // give it 3 more seconds
phent_settype(my, 0, ph_sphere); // now stop the ball
// box_ptr = null; // free the pointer - we will assign it to a new ball
}



on_space=makebox;


Last edited by coma; 08/01/04 04:11.

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1