Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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 (AemStones, AndrewAMD, gamers, Kingware), 1,679 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
[newton] ent_move command??? #49624
07/20/05 16:55
07/20/05 16:55
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline OP
Developer
Efrint  Offline OP
Developer

Joined: Aug 2004
Posts: 593
Germany
Hallo,

i tried to do a script for a player. Is there a command in newton like ent_move? If i use newton in the player-function, the A6 collision-detction doesn´t work anymore. So, if i use c_move or ent_move, the player falls just through the floor. Please take a look at my script and tell me, how i could implement the moving, while pressing the cursor buttons.

Code:
 ACTION pod
{
player=my;
score.visible=on;
my.event=fall_event;
newtoncreategravityentity(wood_material);
while(1)
{

////camera////

update_views();
camera_to_target();

////walking////
ent_cycle("core", my.skill48 % 100);
my.skill48 += 8 * time;
c_move (me,laufen,nullvector,GLIDE+IGNORE_PASSABLE);
c_move (me,unten,nullvector,IGNORE_PASSABLE);




////controle////
if (key_cuu==1)
{

laufen=1;
ent_cycle("run", my.skill48 % 100);

}
else
{
laufen=0;
}

if (key_cud==1)
{

laufen=-1;
}
if (key_cul==1)
{
my.pan+=5*time;
}
if (key_cur==1)
{
my.pan-=5*time;
}


wait(1);
}
}

}



I hope, you can help me....

Regards Efrint

Re: [newton] ent_move command??? [Re: Efrint] #49625
07/20/05 22:43
07/20/05 22:43
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Marcio Esper Offline
Senior Member
Marcio Esper  Offline
Senior Member

Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Hi,

I think you do not need a fall with a wood entity.


try activate it in the game start up. ( before you actavete your entity, the newton ignore it.)

In the behaviors press the start activate check box and take off the fall event in your code, try it, if not work, let me know, and I will try here a solution.

best regards,

Marcio

Re: [newton] ent_move command??? [Re: Marcio Esper] #49626
07/21/05 13:26
07/21/05 13:26
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline OP
Developer
Efrint  Offline OP
Developer

Joined: Aug 2004
Posts: 593
Germany
now i did this....i don´t know, if it is that, what you meant.....it doesn´t work...the player stays at his place and doesn´t fall down.....

Code:
 ACTION pod
{
player=my;
var pod;
score.visible=on;
my.event=fall_event;
newtoncreategravityentity(wood_material);
pod= NewtonGetBody (my);
NewtonSetBodyActiveState (pod,1);

while(1)
{


////camera////

update_views();
camera_to_target();

////walking////
ent_cycle("core", my.skill48 % 100); // wiederhole die Animation endlos
my.skill48 += 8 * time;





////controle////
if (key_cuu==1)
{

laufen=1;
ent_cycle("run", my.skill48 % 100);

}
else
{
laufen=0;
}

if (key_cud==1)
{

laufen=-1;
}
if (key_cul==1)
{
my.pan+=5*time;
}
if (key_cur==1)
{
my.pan-=5*time;
}


wait(1);
}
}

}



why doesn´t that work?

Regards Efrint

Re: [newton] ent_move command??? [Re: Efrint] #49627
07/21/05 14:09
07/21/05 14:09
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Marcio Esper Offline
Senior Member
Marcio Esper  Offline
Senior Member

Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
try put this function and change in the start of your code
if you get a error, double definition or some thing like this, look if you do not have include this in your main script includes like newtinScript2.wdl
if yes, just delet the defines lines and function.

Code:


define newtonGravity, -700.0;
define mass, skill1; // you need set this in your behaviors entity window
define linear_drag, skill2;
define angular_drag_x, skill3;
define angular_drag_y, skill4;
define angular_drag_z, skill5;
define health, skill6;
define shape_factor, skill7;
define collision_groupId, skill8;
define collision_sph_box, flag1;
define start_active, flag2;
define compound_collision, flag3;
define destructible, flag4;
define spawn_children, flag5;

function ApplyGravityForceEvent(body)
{
var bodyMass;

bodyMass = NewtonGetBodyMass (body);
NewtonBodyAddForce (body, 0, 0, bodyMass * newtonGravity);
NewtonBodyAddTorque (body, 0, 0, 0);//

// apply buoyancy force to the boby if any
ApplyBuoyancy (body);
wait(1); // For not use so much CPU you can encrese this but you
// get a delay in action
}

ACTION pod
{
player=my;
score.visible=on;
NewtonGetBody (my);
newtoncreategravityentity(wood_material);
NewtonSetBodyActiveState (body,1);

while(1)
{

ApplyGravityForceEvent(my)
////camera////

update_views();
camera_to_target();

////walking////
ent_cycle("core", my.skill48 % 100); // wiederhole die Animation endlos
my.skill48 += 8 * time;





////controle////
if (key_cuu==1)
{

laufen=1;
ent_cycle("run", my.skill48 % 100);

}
else
{
laufen=0;
}

if (key_cud==1)
{

laufen=-1;
}
if (key_cul==1)
{
my.pan+=5*time;
}
if (key_cur==1)
{
my.pan-=5*time;
}


wait(1);
}
}

}




I hope it help you.

Tel me if it works.

best regards,

Marcio

Re: [newton] ent_move command??? [Re: Marcio Esper] #49628
07/21/05 16:42
07/21/05 16:42
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline OP
Developer
Efrint  Offline OP
Developer

Joined: Aug 2004
Posts: 593
Germany
i get an error: crash in NewtonSetBodyActiveState
and you forgot a semicolon....but the rest seems to be ok....how can i solve the error? At the moment nothing works because of the error....

Regards Efrint

Re: [newton] ent_move command??? [Re: Efrint] #49629
07/21/05 21:51
07/21/05 21:51
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Marcio Esper Offline
Senior Member
Marcio Esper  Offline
Senior Member

Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Do you put the values in your model behaviors ?

try use

NewtonSetBodyAutoActiveState (body, 0); //use this before , it turn off the auto activate
NewtonSetBodyActiveState (body, 1);

You need all parameters in the wed behaviors to it works.

best regards,

MArcio

Re: [newton] ent_move command??? [Re: Marcio Esper] #49630
07/22/05 11:31
07/22/05 11:31
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline OP
Developer
Efrint  Offline OP
Developer

Joined: Aug 2004
Posts: 593
Germany
ok....it doesn´t work....i noticed, that newton crashes in almost every command. I commented ou every command, that crashes.

Code:
 define newtonGravity, -700.0; 
define mass, skill1; // you need set this in your behaviors entity window
define linear_drag, skill2;
define angular_drag_x, skill3;
define angular_drag_y, skill4;
define angular_drag_z, skill5;
define health, skill6;
define shape_factor, skill7;
define collision_groupId, skill8;
define collision_sph_box, flag1;
define start_active, flag2;
define compound_collision, flag3;
define destructible, flag4;
define spawn_children, flag5;

function ApplyGravityForceEvent(body)
{
var bodyMass;

//bodyMass = NewtonGetBodyMass (body);
//NewtonBodyAddForce (body, 0, 0, bodyMass * newtonGravity);
//NewtonBodyAddTorque (body, 0, 0, 0);//

// apply buoyancy force to the boby if any
ApplyBuoyancy (body);
wait(1); // For not use so much CPU you can encrese this but you
// get a delay in action
}

ACTION pod
{
player=my;
score.visible=on;
NewtonGetBody (my);
newtoncreategravityentity(wood_material);
//NewtonSetBodyAutoActiveState (body, 0); //use this before , it turn off the auto activate
//NewtonSetBodyActiveState (body, 1);


while(1)
{

ApplyGravityForceEvent(my);
////camera////

update_views();
camera_to_target();

////walking////
ent_cycle("core", my.skill48 % 100); // wiederhole die Animation endlos
my.skill48 += 8 * time;





////controle////
if (key_cuu==1)
{

laufen=1;
ent_cycle("run", my.skill48 % 100);

}
else
{
laufen=0;
}

if (key_cud==1)
{

laufen=-1;
}
if (key_cul==1)
{
my.pan+=5*time;
}
if (key_cur==1)
{
my.pan-=5*time;
}


wait(1);
}
}

}



everything, that crashes is commented out with //. But even now, i receive the error: crash in newtonsetbodyautoactivestate
but that is commented out! Why does it crash?

Regards Efrint

Re: [newton] ent_move command??? [Re: Efrint] #49631
07/23/05 06:39
07/23/05 06:39
Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
Marcio Esper Offline
Senior Member
Marcio Esper  Offline
Senior Member

Joined: Sep 2002
Posts: 344
São Paulo SP Brazil
hmmm, maybe some body with more know how with newton can help you, I do not know what is making your newton crash, sorry.
I am just using it a low time.
best regards,

Marcio

Re: [newton] ent_move command??? [Re: Marcio Esper] #49632
07/24/05 06:48
07/24/05 06:48
Joined: Sep 2004
Posts: 1,214
Austin, Texas
Josh_Arldt Offline
Senior Developer
Josh_Arldt  Offline
Senior Developer

Joined: Sep 2004
Posts: 1,214
Austin, Texas
@Efrint are you trying to make the player have collisions with/effect the newton objects(like in HL2 or Far Cry)?
If you are they way you are doing it is terrible and won't work...
The way you do it the physics properties for the player will not be updated(the physics collisions ect will not follow him). This will result in a player that just falls through the floor.

Instead you have to make a seperate object for collisions and update them in the direction if the player by adding impulses.
Maybe tomorrow I can upload a little open-source demo for you to look at.

Re: [newton] ent_move command??? [Re: Josh_Arldt] #49633
07/24/05 07:57
07/24/05 07:57
Joined: Aug 2004
Posts: 593
Germany
Efrint Offline OP
Developer
Efrint  Offline OP
Developer

Joined: Aug 2004
Posts: 593
Germany
yes, that would be nice....

Page 1 of 2 1 2

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