Wheeled vehicle tire decal
by Roshan Kuriyan · in Torque Game Engine · 01/10/2007 (12:16 am) · 4 replies
Here is my code for applying decal for my wheeled vehicle , i am getting the decal in my road , but when vehicle skids or turned the decal angle is not rotated . pls check my code . fault should be at addDecal function ,in rotational parameter , any suggestions how to add wheell rotation will be appreciated.
void WheeledVehicle::updatetirethreads()
{
Point3F vel = Parent::getVelocity();
F32 speed = vel.len();
Wheel* wend = &mWheel[mDataBlock->wheelCount];
//U32 contactCount = 0;
// for (Wheel* wheel = mWheel; wheel < wend; wheel++)
// {
// if (wheel->tire && wheel->spring && wheel->surface.contact)
// contactCount++;
// }
if(mDataBlock->decalData != NULL && ( InteriorObjectType | TerrainObjectType) )
{
for(Wheel* wheel = mWheel; wheel < wend; wheel++)
{
if(wheel->slipping && wheel->surface.contact && speed > 10.0f)
mSceneManager->getCurrentDecalManager()->addDecal(wheel->surface.pos, Point3F(wheel->apos * M_2PI,0,0),wheel->surface.normal,mDataBlock->decalData);
}
}
}
void WheeledVehicle::updatetirethreads()
{
Point3F vel = Parent::getVelocity();
F32 speed = vel.len();
Wheel* wend = &mWheel[mDataBlock->wheelCount];
//U32 contactCount = 0;
// for (Wheel* wheel = mWheel; wheel < wend; wheel++)
// {
// if (wheel->tire && wheel->spring && wheel->surface.contact)
// contactCount++;
// }
if(mDataBlock->decalData != NULL && ( InteriorObjectType | TerrainObjectType) )
{
for(Wheel* wheel = mWheel; wheel < wend; wheel++)
{
if(wheel->slipping && wheel->surface.contact && speed > 10.0f)
mSceneManager->getCurrentDecalManager()->addDecal(wheel->surface.pos, Point3F(wheel->apos * M_2PI,0,0),wheel->surface.normal,mDataBlock->decalData);
}
}
}
#2
01/19/2007 (10:30 am)
@Roshan - The decal manager doesn't give you control over rotation when applying a decal.... but it also wasn't meant to do long tire skids. If i were solving the problem i would develop a new "segmented" decal system into the decal manager.
#3
01/22/2007 (10:29 am)
Not to mention the determining factors for wheel slippage are not exactly accurate by a long shot. I have made something like yours Roshan but I have the smae types of problems. But also there is the fact that I can make the buggy sit and burn tires in a donut and it doesn't register as slipping.
#4
By doing this you can use the "axis" value instead of "Point3F(wheel->apos * M_2PI,0,0)" in your code and it works pretty good. Since it already works for the direction of dust particle emitting. That should fix your directional problems but I am still working on the rate since the decals tend to stutter much like Tom said. He is right segmenting them is probably the answer.
Right now I have my method working to 40 MPH before it starts to stutter which is fairly close to the actaul way a long tire skid works.
However I am still having issues with it properly registering slipping in the wheels.
01/23/2007 (7:22 am)
Well I ended up adding my code into the void WheeledVehicle::updateWheelParticles(F32 dt) since while the tire tread was nice for cosmetics it wasn't something that everyone else had to see either and is probably a good idea if you are wanting to limit lag.By doing this you can use the "axis" value instead of "Point3F(wheel->apos * M_2PI,0,0)" in your code and it works pretty good. Since it already works for the direction of dust particle emitting. That should fix your directional problems but I am still working on the rate since the decals tend to stutter much like Tom said. He is right segmenting them is probably the answer.
Right now I have my method working to 40 MPH before it starts to stutter which is fairly close to the actaul way a long tire skid works.
However I am still having issues with it properly registering slipping in the wheels.
Torque Owner Ronald J Nelson
Code Hammer Games