If I start to go forward turret slides back.Drawing mesh turret is not in sync with a mesh body when there are changes in the matrix of the actor. use two actors, body and turret. After the destruction of the turret to fly off with special effects)
wheel[0].angle(angle).accel(accel).brake(brake); // set angle, acceleration and brakes to left -front wheel
wheel[1].angle(angle).accel(accel).brake(brake); // set angle, acceleration and brakes to right-front wheel
}
}
void StructBRDM::draw()
{
body .draw(actor_car .matrix());
turret.draw(actor_turret.matrix());
actor_car.massCenterW().draw(RED); // draw mass center
}
1. Temporary load your body.mesh and turret.mesh in to model editor and move turret in correct position over body. Next...
2. Load your turret.phys
3. Set your turret phys shape in the same position as turret mesh part (this will be your vector which you are setting here: +Vec( 0.0f, 0.9f,-0.2f ) ) and save changes in turret.phys file.
4. Change your code:
actor_turret.matrix( (actor_car.matrix() );
(This post was last modified: 11-17-2011 07:24 PM by Mardok.)
1. Temporary load your body.mesh and turret.mesh in to model editor and move turret in correct position over body. Next...
2. Load your turret.phys
3. Set your turret phys shape in the same position as turret mesh part (this will be your vector which you are setting here: +Vec( 0.0f, 0.9f,-0.2f ) ) and save changes in turret.phys file.
4. Change your code:
actor_turret.matrix( (actor_car.matrix() );
Thank you very much for the detailed response! now it works)
But now another problem.With the rotation of the turret.
If I click "KB_LEFT" turret rotates but its center is shifted(
This should resolve your problem in the simplest way:
In my project i'm using seperate mesh files for wheels(2 files - wheelL.mesh and wheelR.mesh). Mesh should be centered its important!!! It's smart for me because, a lot of vehicles are using the same wheels. And problem with bad position not exists... only draw mesh by matrix and working fine.
This should resolve your problem in the simplest way:
In my project i'm using seperate mesh files for wheels(2 files - wheelL.mesh and wheelR.mesh). Mesh should be centered its important!!! It's smart for me because, a lot of vehicles are using the same wheels. And problem with bad position not exists... only draw mesh by matrix and working fine.
Thanks, but I was curious to know how to do this without creating separate files wheels.I created separate files meshes wheels "wheels_left" "wheels_right" and it was not a problem
Code:
wheel_left ->draw(wheel[0].matrix());
.It always works fine)
I am wondering how to do it with MeshPart mesh->hideAll().show("wheel_left" ).draw(wheel[0].matrix()); -this is a problem