|
any better way to attach turret to the tankbody?
#306924
01/25/10 20:30
01/25/10 20:30
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
Hi!
when i attach my turret to my tank body i do like this:
my.x = you.x; my.y = you.y; my.z = you.z; my.tilt = you.tilt; my.roll = you.roll;
it works fine, as long as i don't turn the turret, i can go up mountains and all that, but if i turn the turret and try to drive up mountains, then my turret tilts different then the tankbody.
so i wanted to ask: is there any other way to attach the turret to the tankbody and don't get problems like this?
thanks for the helps!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Progger]
#306929
01/25/10 21:05
01/25/10 21:05
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
Hi
i looked at the code, but it doesn't tell how to make the turret tilt the same way the tankbody gets tilt, when i drives up the "mountains"
thanks!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Muhsin]
#306931
01/25/10 21:32
01/25/10 21:32
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
Serious User
|
Serious User
Joined: Aug 2007
Posts: 1,922
Schweiz
|
I have this Code to attach a Weapon to a Player. Maybee you can use it for your Project:
VECTOR Vertex_pos_1
VECTOR Vertex_pos_2
VECTOR Vertex_pos_3
VECTOR Vertex_norm
VECTOR Vertex_ebene_1
VECTOR Vertex_ebene_2
VECTOR Vertex_roll
void SETZE_ANGEH_GST(vertex_1,vertex_2,vertex_3,plus_pan,plus_tilt,plus_roll)
{
proc_mode = PROC_LATE;
vec_for_vertex (Vertex_pos_1,you,vertex_1); // Hole Vertex - Positionen
vec_for_vertex (Vertex_pos_2,you,vertex_2);
vec_for_vertex (Vertex_pos_3,you,vertex_3);
vec_for_normal (Vertex_norm,you,vertex_2);
vec_add (Vertex_norm,Vertex_pos_2);
vec_set (my.x, Vertex_norm); // Set my Position to vertex_2
vec_sub(Vertex_pos_1,Vertex_pos_2); // Set pan and tilt
vec_to_angle(my.pan,Vertex_pos_1);
my.pan += plus_pan;
my.tilt += plus_tilt;
my.roll = 0; // Set roll
vec_sub(Vertex_pos_2,Vertex_pos_3);
vec_set (Vertex_ebene_1, vector(0,1,0));
vec_rotate (Vertex_ebene_1, my.pan);
vec_set (Vertex_ebene_2, vector(0,0,1));
vec_rotate (Vertex_ebene_2, my.pan); // This Vectors set the plane
Vertex_roll.x = vec_dot (Vertex_ebene_1, Vertex_pos_2);
Vertex_roll.y = vec_dot (Vertex_ebene_2, Vertex_pos_2);
vec_to_angle (Temp_ang1, Vertex_roll);
my.roll = Temp_ang1.pan + plus_roll;
}
Call this function in a while loop. The vertex_1 - vertex_3 are 3 vertices in position of a "L" at the tank, where do you want to set your turret. Play with the vars pan_plus. EDIT: Or a easier way: Use a bone at the Position where you want add your turrent, set the turrent with vec_for_bone and ang_for_bone, and turn your turrent with ent_bonerotate
Last edited by Widi; 01/25/10 21:44.
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Widi]
#307000
01/26/10 15:12
01/26/10 15:12
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
Hi Widi!
i tried to do like this:
vec_for_bone(turretcoord, your, "turret"); ang_for_bone(turretang, your, "turret"); vec_set(my.x, turretcoord.x);
the first part with the vec_for_bone works with vec_set, but i don't know how to end the ang_for_bone code, how do i do?
thanks!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Muhsin]
#307001
01/26/10 15:17
01/26/10 15:17
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
OK!, found the problem. Thank you very much for the helps!!!
thanks!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Muhsin]
#307003
01/26/10 15:21
01/26/10 15:21
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
Now i got another problem, it works, but if i turn the turret, then it tilts the wrong way??
thanks!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Widi]
#307010
01/26/10 15:47
01/26/10 15:47
|
Joined: Nov 2008
Posts: 196 the wrong place
Muhsin
OP
Member
|
OP
Member
Joined: Nov 2008
Posts: 196
the wrong place
|
yea, sorry, i forgot to use the ent_bonerotate..
now it works!!
thanks!!
- Muhsin Kaymak
Come and play my new browsergame - Valley Of Wolves: http://www.mafiacreator.com/ValleyOfWolvesHurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it! And be the most feared MafiaBoss in the World!!
|
|
|
Re: any better way to attach turret to the tankbody?
[Re: Muhsin]
#307212
01/27/10 20:40
01/27/10 20:40
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
You should post the code that works so when other people search the forums they can see your solution.
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
|