searched and searched and found nothing, so,
whats the best way to do skid marks?
ive grabbed some variables from the wheels and can get when it is sliding and even what surface its on and managed to add tyre smoke from there, all the attempts at leaving marks on the floor so far look terrible.
decals get too spaced out at high speed and anim trails just look rubbish.
any tips on what to use and any settings i should be aware of?
thanks
heres the function in my vehicle if anyones interested
my vehicle is called C_CarPawn.cpp
void AC_CarPawn::TraceSkid()
{
// Simulation
UWheeledVehicleMovementComponent4W* Vehicle4W = CastChecked<UWheeledVehicleMovementComponent4W>(VehicleMovement);
//iterate through all the wheels
for (int32 Itr = 0; Itr < 4; Itr++)
{
//should prob use abs() or whatever
if (Vehicle4W->Wheels[Itr]->DebugLatSlip > SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLongSlip > SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLatSlip < -SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLongSlip < -SkidThreshold)
{
//we iz skiddin
if (Vehicle4W->Wheels[Itr]->GetContactSurfaceMaterial()) //on the floor, will use GetContactSurfaceMaterial() later to change particle based on surface
{
//bottom of the wheel location
const FVector ParticleLoc = Vehicle4W->Wheels[Itr]->Location + FVector(0, 0, 1) * -(Vehicle4W->Wheels[0]->ShapeRadius / 2);
//spawn smoke particle
UGameplayStatics::SpawnEmitterAtLocation(, SmokeParticle, ParticleLoc, GetActorRotation());
}
}
}
}
If you have a look at the VehicleGame (downloaded off marketplace) they have an example of how can be done, there is a tyre_track static mesh & material, as well as some particle . It looks like the implementation is done in code, as the blueprint doesn’t reference it, but I haven’t looked through it yet. See attached for what I did find though.
Wow is awesome man I don’t know any programming but can kinda understand what is going on in the code. To implement would I need to add code to the car Template and then set up a ContactSurfaceMaterial object/asset in the editor?
thank you , ill check out epics example, didnt realize it had a tyre track.
@joe1029
yes add it to the car template, the vehicle pawn it creates from the c++ version
heres everything you need to add
in your car.h, directly under GENERATED_UCLASS_BODY()
/** more slide than wea are skidding */
UPROPERTY(Category = Skid, EditAnywhere)
float SkidThreshold = 0.4;
/** tyre smoke particle, make a blueprint of class and add the particle in default properties */
UPROPERTY(EditAnywhere, Category = Skid)
UParticleSystem* SmokeParticle;
//skid trace, misleading name sorry, turned out you can get everything from the wheel class
void TraceSkid();
in your car.cpp, call TraceSkid() in Tick()
blah::Tick(..)
{
...... stuff already there...
TraceSkid();
}
void AC_CarPawn::TraceSkid()
{
// Simulation
UWheeledVehicleMovementComponent4W* Vehicle4W = CastChecked<UWheeledVehicleMovementComponent4W>(VehicleMovement);
//iterate through all the wheels
for (int32 Itr = 0; Itr < 4; Itr++)
{
//should prob use abs() or whatever
if (Vehicle4W->Wheels[Itr]->DebugLatSlip > SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLongSlip > SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLatSlip < -SkidThreshold || Vehicle4W->Wheels[Itr]->DebugLongSlip < -SkidThreshold)
{
//we iz skiddin
if (Vehicle4W->Wheels[Itr]->GetContactSurfaceMaterial()) //on the floor, will use GetContactSurfaceMaterial() later to change particle based on surface
{
//bottom of the wheel location
const FVector ParticleLoc = Vehicle4W->Wheels[Itr]->Location + FVector(0, 0, 1) * -(Vehicle4W->Wheels[0]->ShapeRadius / 2);
//spawn smoke particle
UGameplayStatics::SpawnEmitterAtLocation(, SmokeParticle, ParticleLoc, GetActorRotation());
}
}
}
}
GetContactSurfaceMaterial() is used in that function to test if the wheel is in contact with a surface, any surface, i plan to use it to get the surface type later, there is no need to do anything with materials or anything if you use it as is.
right so, Epics version is basically the same although much more elaborate.
on the first quick glance it looks as if the particle is attached at the start of the slide and deactivated at the end. there is no special thing going on for the mark.
the actual tyre mark is just part of the particle system, a Mesh Data particle with some fancy things going.
guess i need to rewrite my version or just use epics, the one i posted above is fine for just smoke though.
Hi tegleg! Many thank’s for your help on forum!
First I want apologize for my terrible English, but I guess able convey the idea.
I’m trying to make drift-game and would like to ask your help. You updated your version of thread code for skyd mark’s or epic version better?
And Prompt please how can I calculate the angle drifting for scoring (as you did to one of your video). For 4.7 can I just add the C++ Class without implement the code in each car?
hello sorry for the late response
the drift cars i made with udk (unreal engine 3) that used a previous and much more reliable incarnation of physx.
though the same principles apply for the scoring, i got the sideways speed and added score from that.
i couldn’t tell you how to do it with ue4 as i rarely touch it.