Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (Ayumi), 662 guests, and 3 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
Page 1 of 2 1 2
Turn by traction??? #51758
08/13/05 00:08
08/13/05 00:08
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
hi...

I want to turn a vehcile by traction...
like MarsRover in newton engine...

but in a6 engine when i set the left wheels (1000,500,0)
and right wheel (-1000,250,0)
or any other var's the vehicle dosent turn somebody can explain me how to do it correctly?

Re: Turn by traction??? [Re: Matan_Golan1] #51759
08/14/05 17:57
08/14/05 17:57
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
anyone? please?

Re: Turn by traction??? [Re: Matan_Golan1] #51760
08/15/05 19:59
08/15/05 19:59
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
how does your wheels code looks like ??
post some code, i'll look at it later then.


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Turn by traction??? [Re: Helghast] #51761
08/19/05 22:46
08/19/05 22:46
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
Here is my Code:


//Entitys:
entity* tank_body;
entity* r_wheel1;
entity* r_wheel2;
entity* r_wheel3;
entity* r_wheel4;
entity* l_wheel1;
entity* l_wheel2;
entity* l_wheel3;
entity* l_wheel4;

//Gravity:
var gravity[3] = 0,0,-380;

//Tyres:
var tyre_elastic = 1;
var tyre_fric = 120;
var tyre_mass = 130;
var tyre_min_speed = 7;

//Tank Body:
var tank_elastic = 1;
var tank_firc = 40;
var tank_mass = 130;
var tank_min_speed = 5;

//Con's ID'S:
var r_wheel1_id;
var r_wheel2_id;
var r_wheel3_id;
var r_wheel4_id;
var l_wheel1_id;
var l_wheel2_id;
var l_wheel3_id;
var l_wheel4_id;

//Con's Param's:
var parm1[3];
var parm2[3];
var parm3[3];
var parm4[3];
var parm5[3];
var parm6[3];

//Movement Vars:
var motor1[3];
var motor2[3];





sky sky_box
{
type = <sk_free1_512+6.tga>;
flags = cube,visible;

layer = 5;
}




action ph_tank_body
{


tank_body = my;

tank_body.shadow = on;
tank_body.overlay = off;
tank_body.flare = off;
tank_body.bright = off;
tank_body.transparent = off;
tank_body.ambient = 50;

ph_setgravity(vector(0,0,-2086));

phent_settype(my,ph_rigid,ph_poly);
phent_setgroup(my,2);
phent_setmass(my,tank_mass,ph_poly);
phent_setfriction(my,tank_firc);
phent_setdamping(my,50,50);
phent_setelasticity(my,tank_elastic,tank_min_speed);

}

action tank_r_wheel1
{
r_wheel1 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

r_wheel1_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(r_wheel1_id,my.x,parm2,parm3);
phcon_setparams2(r_wheel1_id,parm4,nullvector,parm6);
}

action tank_r_wheel2
{
r_wheel2 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

r_wheel2_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(r_wheel2_id,my.x,parm2,parm3);
phcon_setparams2(r_wheel2_id,parm4,nullvector,parm6);
}

action tank_r_wheel3
{
r_wheel3 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

r_wheel3_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(r_wheel3_id,my.x,parm2,parm3);
phcon_setparams2(r_wheel3_id,parm4,nullvector,parm6);
}

action tank_r_wheel4
{
r_wheel4 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

r_wheel4_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(r_wheel4_id,my.x,parm2,parm3);
phcon_setparams2(r_wheel4_id,parm4,nullvector,parm6);
}

action tank_l_wheel1
{
l_wheel1 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

l_wheel1_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(l_wheel1_id,my.x,parm2,parm3);
phcon_setparams2(l_wheel1_id,parm4,nullvector,parm6);
}

action tank_l_wheel2
{
l_wheel2 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

l_wheel2_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(l_wheel2_id,my.x,parm2,parm3);
phcon_setparams2(l_wheel2_id,parm4,nullvector,parm6);
}

action tank_l_wheel3
{
l_wheel3 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

l_wheel3_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(l_wheel3_id,my.x,parm2,parm3);
phcon_setparams2(l_wheel3_id,parm4,nullvector,parm6);
}

action tank_l_wheel4
{
l_wheel4 = my;

my.invisible = on;

phent_settype(my,ph_rigid,ph_sphere);
phent_setgroup(my,2);
phent_setmass(my,tyre_mass,ph_sphere);
phent_setfriction(my,tyre_fric);
phent_setdamping(my,50,50);
phent_setelasticity(my,tyre_elastic,tyre_min_speed);

vec_set(parm2,vector(0,0,1));
vec_set(parm3,vector(0,1,0));
vec_set(parm4,vector(0,0,0));
vec_set(parm6,vector(90000,100,0));

l_wheel4_id = phcon_add(ph_wheel,tank_body,my);

phcon_setparams1(l_wheel4_id,my.x,parm2,parm3);
phcon_setparams2(l_wheel4_id,parm4,nullvector,parm6);
}


function tank_move()
{
while(1)
{
if(key_cuu)
{
vec_set(motor1,vector(-1000,500,0));
vec_set(motor2,vector(-1000,500,0));
}

if(key_cud)
{
vec_set(motor1,vector(1000,500,0));
vec_set(motor2,vector(1000,500,0));
}

if(key_cud == 0 && key_cuu == 0) || (key_cud == 1 && key_cuu == 1)
{
vec_set(motor1,vector(0,0,0));
vec_set(motor2,vector(0,0,0));
}





phcon_setmotor(r_wheel1_id,nullvector,motor1,nullvector);
phcon_setmotor(r_wheel2_id,nullvector,motor1,nullvector);
phcon_setmotor(r_wheel3_id,nullvector,motor1,nullvector);
phcon_setmotor(r_wheel4_id,nullvector,motor1,nullvector);

phcon_setmotor(l_wheel1_id,nullvector,motor2,nullvector);
phcon_setmotor(l_wheel2_id,nullvector,motor2,nullvector);
phcon_setmotor(l_wheel3_id,nullvector,motor2,nullvector);
phcon_setmotor(l_wheel4_id,nullvector,motor2,nullvector);

if(key_o == 1)
{
l_wheel1.invisible = off;
l_wheel2.invisible = off;
l_wheel3.invisible = off;
l_wheel4.invisible = off;
r_wheel1.invisible = off;
r_wheel2.invisible = off;
r_wheel3.invisible = off;
r_wheel4.invisible = off;
}

if(key_o == 0)
{
l_wheel1.invisible = on;
l_wheel2.invisible = on;
l_wheel3.invisible = on;
l_wheel4.invisible = on;
r_wheel1.invisible = on;
r_wheel2.invisible = on;
r_wheel3.invisible = on;
r_wheel4.invisible = on;
}



wait(1);
}
}


function camera_control()
{
var force[3];
while(1)
{

if(!mouse_right)
{
camera.pan-=20*mouse_force.x*time;
camera.tilt+=20*mouse_force.y*time;
}

vec_set(force,nullvector);
if(key_a)
{
force.x-=1;
}
if(key_d)
{
force.x+=1;
}
if(key_w)
{
force.y+=1;
}
if(key_s)
{
force.y-=1;
}

if(key_a & key_shift)
{
force.x-=3;
}
if(key_d & key_shift)
{
force.x+=3;
}
if(key_w & key_shift)
{
force.y+=3;
}
if(key_s & key_shift)
{
force.y-=3;
}

camera.x+=20*cos(camera.pan)*cos(camera.tilt)*force.y*time;
camera.y+=20*sin(camera.pan)*cos(camera.tilt)*force.y*time;
camera.z+=20*sin(camera.tilt)*force.y*time;
camera.x-=20*cos(camera.pan+90)*force.x*time;
camera.y-=20*sin(camera.pan+90)*force.x*time;
wait(1);
}






}
}

function show_info()
{

while(1)
{

draw_text("Current FPS:",10,15,vector(255,0,0));
draw_text("Shadow Memorey:",10,35,vector(250,250,250));
draw_text("Bmaps Memorey:",10,55,vector(250,250,250));
draw_text("Skins Memorey:",10,75,vector(250,250,250));
draw_text("Surface Memorey:",10,95,vector(250,250,250));
draw_text("Total Time:",10,115,vector(0,255,0));

wait(1);
}

}




//Main Starting Function:
function main()
{
level_load(level_str);
wait(3);
clip_size = 1;
d3d_anisotropy = 5;
d3d_mipmapping = 3;
d3d_shadowdepth = 24;
fps_min = 30;
camera_control(); // get camera control by WASD
//All engine pre-setes are defined
//Call further function here:

tank_move();
ph_setgravity(vector(0,0,-500));
ph_setcorrections(30000,0.05);
show_info();

}

Re: Turn by traction??? [Re: Matan_Golan1] #51762
08/20/05 10:04
08/20/05 10:04
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
this should work, in your tank_move function make a new (or 2 new if's) for rotating:

if(key_cur)
{
vec_set(motor1,vector(-1000,500,0));
vec_set(motor2,vector(1000,500,0));
}
if(key_cul)
{
vec_set(motor1,vector(1000,500,0));
vec_set(motor2,vector(-1000,500,0));
}

hope it works for you.
regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Turn by traction??? [Re: Helghast] #51763
08/20/05 11:41
08/20/05 11:41
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
I did it before dude...

it dosent work...

i tried everything i really dont know what to do

Re: Turn by traction??? [Re: Matan_Golan1] #51764
08/20/05 14:57
08/20/05 14:57
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
ah, sorry, misread that line in your first post.
another idea, maybe you could update the wheels so they stand 90 degrees rotated, then let one side ride "forward" that way you get faked traction rotation.

i'll try out later here myself how to do it.
but am atm busy on a trashable car code.
regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Turn by traction??? [Re: Helghast] #51765
08/21/05 14:17
08/21/05 14:17
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
tried that too, dosent work

Re: Turn by traction??? [Re: Matan_Golan1] #51766
08/22/05 07:09
08/22/05 07:09
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
seems like a hard task...
you got msn? maybe it's easier over there to do the job *testing is easier that way*

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Turn by traction??? [Re: Helghast] #51767
08/22/05 11:39
08/22/05 11:39
Joined: Jul 2005
Posts: 34
M
Matan_Golan1 Offline OP
Newbie
Matan_Golan1  Offline OP
Newbie
M

Joined: Jul 2005
Posts: 34
i have icq:
172228566

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