|
0 registered members (),
635
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Joining Wheels to a body
#158237
10/02/07 15:26
10/02/07 15:26
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec
OP

Expert
|
OP

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
Allright this is very tricky for me and I tried it on many ways but somehow I cant get it done. The wheels that are created are on the right position. and my car allready can drive forward but if I press S and attach the tries to the car body it cant move I also trief moving with ignore_passable or ignore_flag2 but It wont work. And I notice that my tires wont move with my car I would be really greafull if someone could help me with it so heres my code. Code:
function wheels_left { my.pan = 0; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; my.flag2 = on; }
function wheels_right { my.pan = -180; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; my.flag2 = on; }
function create_wheels { wheel1 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,48),wheels_right); wheel2 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,47),wheels_right); wheel3 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,46),wheels_left); wheel4 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,45),wheels_left); }
action test_car { Auto = me; my.scale_x = 3; my.scale_y = 3; my.scale_z = 3; while(1) { if(key_cuu == on) { c_move(Auto,vector(3*time,0,0),nullvector,use_box|ignore_flag2); } wait(1); } }
on_s = create_wheels; Regards Aztec 
Visit: schwenkschuster-design.de
|
|
|
Re: Joining Wheels to a body
[Re: vlau]
#158239
10/02/07 16:10
10/02/07 16:10
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec
OP

Expert
|
OP

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
well the thing is just that I dont use plane mine is a car but I´ll try it anyway thx  EDIT: it didnt work 
Last edited by aztec; 10/02/07 16:15.
Visit: schwenkschuster-design.de
|
|
|
Re: Joining Wheels to a body
[Re: aztec]
#158240
10/03/07 04:58
10/03/07 04:58
|
Joined: Dec 2005
Posts: 478 India
msl_manni
Senior Member
|
Senior Member
Joined: Dec 2005
Posts: 478
India
|
my.parent = you; my._vertex = 48; while(1) { vec_for_vertex(my.x,my.parent,my._vertex); wait(1); }
You will have to add similar logic to each wheel if you want them to be linked to your car. First try to apply the above logic to your car, it will supposedly work, or I will try to work it out.
My Specialities Limited.
|
|
|
Re: Joining Wheels to a body
[Re: msl_manni]
#158241
10/03/07 06:41
10/03/07 06:41
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec
OP

Expert
|
OP

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
yeah this will propably solve the sticking problem nice idea. Now I still need to know how I can move my car but I allways is stuck in the Wheels  Regards Aztec PS: Great Comunity here you allways help me  EDIT: Your code actually worked veeeeery fine  now I gotta solve that moving problem^^
Last edited by aztec; 10/03/07 08:55.
Visit: schwenkschuster-design.de
|
|
|
Re: Joining Wheels to a body
[Re: aztec]
#158242
10/03/07 09:12
10/03/07 09:12
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec
OP

Expert
|
OP

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
Opps I noticed I posted in the wrong forum but I still cant get this car going on. its like if I make the wheels passable. and move my car with ingnore_passable it just move with a realy high speed straight to the top  This is what I have for the code now  I can just move the car with my.x +=1*time but no collision Code:
function wheels_left { my.pan = 0; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; c_setminmax(my); // TEST my.parent = you; my_vertex1 = 46; while(1) { vec_for_vertex(my.x,my.parent,my_vertex1); wait(1); } // }
function wheels_left2 { my.pan = 0; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; c_setminmax(my); // TEST my.parent = you; my_vertex2 = 45; while(1) { vec_for_vertex(my.x,my.parent,my_vertex2); wait(1); } // }
function wheels_right { my.pan = -180; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; c_setminmax(my); // TEST my.parent = you; my_vertex3 = 48; while(1) { vec_for_vertex(my.x,my.parent,my_vertex3); wait(1); } // }
function wheels_right2 { my.pan = -180; my.scale_x = 2; my.scale_y = 2; my.scale_z = 2; my.narrow = on; c_setminmax(my); // TEST my.parent = you; my_vertex4 = 47; while(1) { vec_for_vertex(my.x,my.parent,my_vertex4); wait(1); } // }
function create_wheels() { wheel1 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,48),wheels_right); wheel2 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,47),wheels_right2); wheel3 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,46),wheels_left); wheel4 = ent_create(car_wheel,vec_for_vertex(nullvector,Auto,45),wheels_left2); }
action test_car { Auto = me; my.scale_x = 3; my.scale_y = 3; my.scale_z = 3; my.polygon = on; c_setminmax(my); create_wheels(); while(1) { if(key_cuu == on) { c_move(me,vector(1*time,0,0),nullvector,use_box); wheel1.tilt +=3*time; wheel2.tilt +=3*time; wheel3.tilt -=3*time; wheel4.tilt -=3*time; } if(key_cud == on) { my.x -=3*Time; wheel1.tilt -=3*time; wheel2.tilt -=3*time; wheel3.tilt +=3*time; wheel4.tilt +=3*time; } wait(1); } }
Visit: schwenkschuster-design.de
|
|
|
Re: Joining Wheels to a body
[Re: aztec]
#158243
10/03/07 15:51
10/03/07 15:51
|
Joined: Aug 2005
Posts: 1,558 HK
vlau
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,558
HK
|
You don't need to set my.narrow = on to your wheels because c_setminmax already done it automatically.
You should not set my.polygon = on in your car action because this flag is only suitable for non-moveable object, oppositely set the polygon flag to the ground model or terrain.
I think use_box is not available for c_move, maybe "glide" is better.
The c_move function only move the car body with collision but not the wheels, I'm afraid that there will be a problem when you ride it on steep or slope terrain but it can be solved by setting the car's min_z and max_z.
EDIT : I mean to set the min_z and max_z of your car body to cover all wheels.
Last edited by vlau; 10/03/07 16:04.
|
|
|
Re: Joining Wheels to a body
[Re: vlau]
#158244
10/03/07 17:00
10/03/07 17:00
|
Joined: Apr 2005
Posts: 2,332 Germany, BaWü
aztec
OP

Expert
|
OP

Expert
Joined: Apr 2005
Posts: 2,332
Germany, BaWü
|
yeah I know what you mean well. I have a new Idea thought it will worsen the gameplay but not very much thx for the help though 
Visit: schwenkschuster-design.de
|
|
|
|