Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 7th_zorro), 892 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Physics for level #244072
01/02/09 13:40
01/02/09 13:40
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
Hello,
At the moment I try to look through the Physic-Engine of 3DGS. If I include eg. gravity power I cant move my model any more.
Does anybody know a tutorial how to use the Engine?

Here my test-script (whats wrong? I cant move on key_i/key_l):
Quote:
function main()
{
level_load ("Physik.wmb");
wait(2);
ph_setgravity (vector (0, 0, -386));//9.81m/s^2
camera.x = - 50;
}

action model()
{
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 3, PH_BOX);
while(1)
{
if (key_i) my.x += 6 *time_step;
if (key_l) my.x += -6 *time_step;
wait(1);
}
}



new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: Physics for level [Re: MPQ] #244073
01/02/09 13:44
01/02/09 13:44
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
you have to move your object using phent_ functions if you use the physics engine on that object.

Last edited by Quadraxas; 01/02/09 13:44. Reason: typo

3333333333
Re: Physics for level [Re: Quad] #244133
01/02/09 21:45
01/02/09 21:45
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
Ok now ive decided to use c_move, but the prob is that my model only move one step (1000*time_step) when I add the "settype" and then it stops in spite of the while-loop. Whats wrong?
Quote:
#include <acknex.h>
#include <default.c>
////////////////////////////
var speed1;

function main()
{
level_load ("Physik.wmb");
wait(2);
ph_setgravity (vector (0, 0, -386));
camera.x = 50;

}

action model()
{
phent_settype (my, PH_RIGID, PH_BOX);

while(1)
{

if (key_i) speed1 = 10 * time_step;
c_move (my, nullvector, vector(0, speed1, 0), NULL);
wait(1);
}

}



new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: Physics for level [Re: MPQ] #244136
01/02/09 22:08
01/02/09 22:08
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Why do you ask here when you dont read the responses? You have to move your object with phent_ functions, not c_move.

And why dont you read the physics tutorial before you start to script? You have to understand the basics before you can program something. I think spending 10 minutes to read the tutorial page is faster than randomly trying commands and then wondering why it does not work.

Re: Physics for level [Re: Spirit] #244141
01/02/09 22:34
01/02/09 22:34
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
sorry, I thought c_move would work with the physic-engine?! I have tried the phent_function but I didn´t get how those work
Quote:
And why dont you read the physics tutorial before you start to script?

oh yes. I have done it but the information you get from it is really a bit too little. Do you know some tut?


new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: Physics for level [Re: MPQ] #244145
01/02/09 22:41
01/02/09 22:41
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
No, but the lessons about physics and movement are ok for programming simple movement. For more complicated movement, just ask here.

When physics has control over an entity, you can not move it manually. When you want to move it yourself, don't make it a physics object.

Re: Physics for level [Re: Spirit] #244318
01/04/09 00:47
01/04/09 00:47
Joined: Oct 2008
Posts: 67
pewpew Offline
Junior Member
pewpew  Offline
Junior Member

Joined: Oct 2008
Posts: 67
duuuude im having the EXACT same problem!!! nobody told me that you cant use 'c_move' when you apply physics to something lol. ive been trying to drive a tank around a map for 2 months.

ok, so you CANT use c_move?

when i go into the physics section in the help menu, you click on "phent_" and it says-
"Here is a list of phent_ commands..."
and thats it. a blank page lol.


HURRR DERP DERP DEERRPP HURR
Re: Physics for level [Re: pewpew] #244374
01/04/09 11:05
01/04/09 11:05
Joined: Nov 2008
Posts: 354
saeculum II
MPQ Offline OP
Senior Member
MPQ  Offline OP
Senior Member

Joined: Nov 2008
Posts: 354
saeculum II
ok you cant use c_move wink At the moment I try with phent_fuction like phent_centralforce and it works so far.

The following is my test script for a movement with physics:
Quote:
#include <acknex.h>
#include <default.c>
////////////////////////////
VECTOR speed1;

function main()
{
level_load ("Physik.wmb");
wait(2);
ph_setgravity (vector (0, 0, -386));
camera.x = 50;

}

action model()
{

phent_settype (my, PH_RIGID, PH_BOX);
phent_setdamping (my, 80, 80);
while(1)
{

//speed up!//
if (key_i && (speed1.x < 50 && (speed1.x >= 0)))//speed up forwards, if speed1 is 0 or higher
speed1.x += 0.02;
if (key_k && (speed1.x > -10 && (speed1.x <= 0)))//speed up backward, if speed1 is lower than 0
speed1.x -= 0.02;

//break!//
if (key_i && (speed1.x < 0))//break, if speed1 is lower 0
speed1.x += 0.04;
if (key_k && (speed1.x > 0))//break, if speed1 is higher than 0
speed1.x -= 0.04;
if (!key_i && !key_k) speed1.x = 0;

phent_addcentralforce (my, speed1);
//phcon_setmotor//ph_setautodisable//ph_autodisable//ii
wait(1);
}

}



new project in early stage...

Intel Xeon X3450 2,66GHz | Mushkin 8 Gib | Zotac GTS250 + 7300LE | A8.3 com
Re: Physics for level [Re: MPQ] #244379
01/04/09 12:02
01/04/09 12:02
Joined: Nov 2005
Posts: 41
Australia
Jazuar_ Offline
Newbie
Jazuar_  Offline
Newbie

Joined: Nov 2005
Posts: 41
Australia
@ pewpew

that's just the introductory page for the rest of the phent_whatever pages
look for things like phent_addcentralforce and the like


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