Announcement

Collapse
No announcement yet.

refreshing myself on the vehicle systems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    No worries Gaz, thanks for all your hard work on the Lambo...

    Comment


      #47
      Has anyone seen existing games with Luigi's designs?

      Comment


        #48
        Originally posted by frankit View Post
        No worries Gaz, thanks for all your hard work on the Lambo...
        doesn't seem right to call it work when you enjoy it so much.

        Comment


          #49
          That's the spirit

          Comment


            #50
            90% done.the doors kind of work right,but don't always swing out and up at the same rate.body shell comes off a little too easily.

            damage materials and lights are next.


            Comment


              #51
              Looks great!

              Comment


                #52


                its starting to feel like a sports car now.having not built a fast car before I found some things didn't work as I thought.ie max speed,but were getting there.

                I should be posting the car last thing tomorrow.

                Comment


                  #53
                  Nice .....

                  Comment


                    #54
                    for the camera I used teglegs all in 1 cam and intergrated the ut3 cam too.

                    add this to the peugot_206._vehicle.uc

                    Code:
                    var name cameratag1, cameratag2;
                    
                    var() name CameraTag;
                    	var int CamType;
                    
                    
                    exec function ChangeCam()
                    ///exec function ChangeCam()
                    {
                        CamType++; //add 1 to CamType
                    
                        if (CamType >= 4)
                        {
                         CamType = 0;
                        }
                    
                    }
                     //all in 1 cam
                    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
                    {
                       local vector X, Y, Z;
                       local vector SocketLoc;
                       local rotator SocketRot;
                       local vector CamPos, CamDir, HitLocation, FirstHitLocation, HitNormal, CamRotX, CamRotY, CamRotZ, SafeLocation;
                       local actor HitActor;
                       local float NewCamStartZ;
                       local UTPawn P;
                       local bool bObstructed, bInsideVehicle, bPivotOnly;
                       local vector CamStart;
                       local float DeltaTime;
                    
                            bPivotOnly=false;
                            DeltaTime=0.0;
                    
                       switch( CamType )
                       {
                    case 0:  //drivercam
                    	    Mesh.GetSocketWorldLocationAndRotation(CameraTag, SocketLoc, SocketRot);
                    
                    	    out_CamLoc = SocketLoc;
                    	    out_CamRot = SocketRot;
                    break;
                    
                    case 1:   // chase cam
                          //this makes the camera stay with the vehicle
                    	GetActorEyesViewPoint( out_CamLoc, out_CamRot );
                    
                    	    GetAxes(Rotation,X,Y,Z);
                    
                    	    // a bit behind
                    		out_CamLoc = Location - 400 * X;
                    		//up a bit
                    		out_CamLoc.Z = Location.Z + 120;
                    
                        ///camera rotation yaw = vehicle rotation yaw
                    	out_CamRot.Yaw = Rotation.Yaw;
                    	//  look down a bit
                    	out_CamRot.Pitch = (-2.0f     *DegToRad) * RadToUnrRot;
                    	//delete this line if you want the cam to roll with the vehicle
                    	///out_CamRot.Roll = 0;
                    break;
                    
                    case 2:  //bonnetcam
                    	    Mesh.GetSocketWorldLocationAndRotation(CameraTag1, SocketLoc, SocketRot);
                    
                    	    out_CamLoc = SocketLoc;
                    	    out_CamRot = SocketRot;
                    break;
                    
                    
                    case 3:   // ut3cam
                    
                    
                    	Mesh.SetOwnerNoSee(false);
                    	if ( (UTPawn(Driver) != None) && !Driver.bHidden && Driver.Mesh.bOwnerNoSee )
                    		UTPawn(Driver).SetMeshVisibility(true);
                    
                    	// Handle the fixed view
                    	P = UTPawn(Seats[0].SeatPawn.Driver);
                    	if (P != None && P.bFixedView)
                    	{
                    		out_CamLoc = P.FixedViewLoc;
                    		out_CamRot = P.FixedViewRot;
                    		//return;
                    	}
                    
                    	CamStart = GetCameraStart(0);
                    
                    	// Get the rotation
                    	if ( (Seats[0].SeatPawn.Controller != None) && !bSpectatedView  )
                    	{
                    		out_CamRot = Seats[0].SeatPawn.GetViewRotation();
                    	}
                    
                    	// support debug 3rd person cam
                    	if (P != None)
                    	{
                    		P.ModifyRotForDebugFreeCam(out_CamRot);
                    	}
                    
                    	GetAxes(out_CamRot, CamRotX, CamRotY, CamRotZ);
                    	CamStart += (Seats[0].SeatPawn.EyeHeight + LookForwardDist * FMax(0,(1.0 - CamRotZ.Z)))* CamRotZ;
                    
                    	/* if bNoFollowJumpZ, Z component of Camera position is fixed during a jump */
                    	if ( bNoFollowJumpZ )
                    	{
                    		NewCamStartZ = CamStart.Z;
                    		if ( (Velocity.Z > 0) && !HasWheelsOnGround() && (OldCamPosZ != 0) )
                    		{
                    			// upward part of jump. Fix camera Z position.
                    			bFixedCamZ = true;
                    			if ( OldPositions.Length > 0 )
                    				OldPositions[OldPositions.Length-1].Position.Z += (OldCamPosZ - CamStart.Z);
                    			CamStart.Z = OldCamPosZ;
                    			if ( NewCamStartZ - CamStart.Z > 64 )
                    				CamStart.Z = NewCamStartZ - 64;
                    		}
                    		else if ( bFixedCamZ )
                    		{
                    			// Camera z position is being fixed, now descending
                    			if ( HasWheelsOnGround() || (CamStart.Z <= OldCamPosZ) )
                    			{
                    				// jump has ended
                    				if ( DeltaTime >= 0.1 )
                    				{
                    					// all done
                    					bFixedCamZ = false;
                    				}
                    				else
                    				{
                    					// Smoothly return to normal camera mode.
                    					CamStart.Z = 10*DeltaTime*CamStart.Z + (1 - 10*DeltaTime)*OldCamPosZ;
                    					if ( abs(NewCamStartZ - CamStart.Z) < 1.f )
                    						bFixedCamZ = false;
                    				}
                    			}
                    			else
                    			{
                    				// descending from jump, still in the air, so fix camera Z position
                    				if ( OldPositions.Length > 0 )
                    					OldPositions[OldPositions.Length-1].Position.Z += (OldCamPosZ - CamStart.Z);
                    				CamStart.Z = OldCamPosZ;
                    			}
                    		}
                    	}
                    
                    	// Trace up to the view point to make sure it's not obstructed.
                    	if ( Seats[0].CameraSafeOffset == vect(0,0,0) )
                    	{
                    		SafeLocation = Location;
                    	}
                    	else
                    	{
                    	    GetAxes(Rotation, X, Y, Z);
                    	    SafeLocation = Location + Seats[0].CameraSafeOffset.X * X + Seats[0].CameraSafeOffset.Y * Y + Seats[0].CameraSafeOffset.Z * Z;
                    	}
                    	// DrawDebugSphere(SafeLocation, 16, 10, 255, 0, 255, FALSE);
                    	// DrawDebugSphere(CamStart, 16, 10, 255, 255, 0, FALSE);
                    
                    	HitActor = Trace(HitLocation, HitNormal, CamStart, SafeLocation, false, vect(12, 12, 12));
                    	if ( HitActor != None)
                    	{
                    			bObstructed = true;
                    			CamStart = HitLocation;
                    			//`log("obstructed 0");
                    	}
                    
                    	OldCamPosZ = CamStart.Z;
                    	if (bPivotOnly)
                    	{
                    		out_CamLoc = CamStart;
                    	//	return;
                    	}
                    
                    	// Calculate the optimal camera position
                    	CamDir = CamRotX * Seats[0].CameraOffset * SeatCameraScale;
                    
                    	// keep camera from going below vehicle
                    	if ( !bRotateCameraUnderVehicle && (CamDir.Z < 0) )
                    	{
                    		CamDir *= (VSize(CamDir) - abs(CamDir.Z))/(VSize(CamDir) + abs(CamDir.Z));
                    	}
                    
                    	CamPos = CamStart + CamDir;
                    
                    	// Adjust for obstructions
                    	HitActor = Trace(HitLocation, HitNormal, CamPos, CamStart, false, vect(12, 12, 12));
                    
                    	if ( HitActor != None )
                    	{
                    		out_CamLoc = HitLocation;
                    		bObstructed = true;
                    		//`log("obstructed 2");
                    	}
                    	else
                    	{
                    		out_CamLoc = CamPos;
                    	}
                    	if ( !bRotateCameraUnderVehicle && (CamDir.Z < 0) && TraceComponent( FirstHitLocation, HitNormal, CollisionComponent, out_CamLoc, CamStart, vect(0,0,0)) )
                    	{
                    		// going through vehicle - it's ok if outside collision on other side
                    		if ( !TraceComponent( HitLocation, HitNormal, CollisionComponent, CamStart, out_CamLoc, vect(0,0,0)) )
                    		{
                    			// end point is inside collision - that's bad
                    			out_CamLoc = FirstHitLocation;
                    			bObstructed = true;
                    			bInsideVehicle = true;
                    			//`log("obstructed 1");
                    		}
                    	}
                    
                    	// if trace doesn't hit collisioncomponent going back in, it means we are inside the collision box
                    	// in which case we want to hide the vehicle
                    	if ( !bCameraNeverHidesVehicle && bObstructed )
                    	{
                    		bInsideVehicle = bInsideVehicle
                    						|| !TraceComponent( HitLocation, HitNormal, CollisionComponent, SafeLocation, out_CamLoc, vect(0,0,0))
                    						|| (VSizeSq(HitLocation - out_CamLoc) < MinCameraDistSq);
                    		Mesh.SetOwnerNoSee(bInsideVehicle);
                    		if ( (UTPawn(Driver) != None) && !Driver.bHidden && (Driver.Mesh.bOwnerNoSee != Mesh.bOwnerNoSee) )
                    		{
                    			// Handle the main player mesh
                    			Driver.Mesh.SetOwnerNoSee(Mesh.bOwnerNoSee);
                    		}
                    	}
                    break;
                    
                    
                    
                    
                    
                       }
                    
                    	return true;
                    }
                    
                    
                    defaultproperties
                    {
                            CameraTag=drivercam
                            CameraTag1=bonnetcam
                            CameraTag2=rearcam
                    }
                    and then add 3 sockets to the mesh and name them drivercam,bonnetcam and rearcam.then you need to add

                    Code:
                    Bindings=(Name="H",Command="ChangeCam"
                    or

                    Code:
                    Bindings=(Name="XboxTypeS_Y",Command="ChangeCam"
                    to UDKinput.ini in the config folder.

                    you can also add

                    Code:
                    var float carspeed, carrevs;
                    
                    
                    function Tick( FLOAT DeltaSeconds )
                    {
                    	local bool bSetBrakeLightOn, bSetReverseLightOn;
                    	
                    	carspeed = (VSize(self.Velocity) * 3.06) * 0.0254;
                            carrevs = EvalInterpCurveFloat(UDKVehicleSimCar(SimObj).EngineRPMCurve, ForwardVel);
                    	
                    
                    	if ( SelfDestructReadyComponent != None )
                    	{
                    		if( !bDriving || (SelfDestructInstigator != None) || !IsLocallyControlled() || !ReadyToSelfDestruct() ) 
                    		{
                    			SelfDestructReadyComponent.Stop();
                    			SelfDestructReadyComponent = None;
                    		}
                    	}
                    	else if( bDriving && !bDeadVehicle && IsLocallyControlled() && ReadyToSelfDestruct() )
                    	{
                    
                    		SelfDestructReadyComponent = CreateAudioComponent(SelfDestructReadyCue,TRUE,TRUE,FALSE);
                    	}
                    
                    	if ( bDeadVehicle )
                    		return;
                    
                    	if ( SelfDestructInstigator != None )
                    	{
                    
                    	}
                    
                    	if (LastRenderTime < WorldInfo.TimeSeconds - 0.2)
                    		return;
                    
                    	if( ( (OutputBrake > 0.0) || bOutputHandbrake) && (VSizeSq(Velocity) > 4.0) )
                    	{
                    		bSetBrakeLightOn = true;
                    		if ( !bBrakeLightOn )
                    		{	
                    
                    			bBrakeLightOn = TRUE;
                    			if(DamageMaterialInstance[0] != None)
                    			{
                    				DamageMaterialInstance[0].SetScalarParameterValue(BrakeLightParameterName, 60.0 );
                    			}
                    		}
                    	}
                    
                    
                    	if ( Throttle < 0.0 )
                    	{
                    		bSetReverseLightOn = true;
                    		if ( !bReverseLightOn )
                    		{
                    
                    			bReverseLightOn = true;
                    			if(DamageMaterialInstance[0] != None)
                    			{
                    				DamageMaterialInstance[0].SetScalarParameterValue(ReverseLightParameterName, 50.0 );
                    			}
                    		}
                    	}
                    
                    	if ( bBrakeLightOn && !bSetBrakeLightOn )
                    	{
                    
                    		bBrakeLightOn = false;
                    		if(DamageMaterialInstance[0] != None)
                    		{
                    			DamageMaterialInstance[0].SetScalarParameterValue(BrakeLightParameterName, 0.0 );
                    		}
                    	}
                    	if ( bReverseLightOn && !bSetReverseLightOn )
                    	{
                    
                    		bReverseLightOn = false;
                    		if(DamageMaterialInstance[0] != None)
                    		{
                    			DamageMaterialInstance[0].SetScalarParameterValue(ReverseLightParameterName, 0.0 );
                    		}
                    	}
                    
                    
                    	if ( bHeadlightsOn )
                    	{
                    		if ( PlayerReplicationInfo == None )
                    		{
                    
                    			bHeadlightsOn = false;
                    			if(DamageMaterialInstance[0] != None)
                    			{
                    				DamageMaterialInstance[0].SetScalarParameterValue(HeadLightParameterName, 0.0 );
                    			}
                    		}
                    	}
                    	else if ( PlayerReplicationInfo != None )
                    	{
                    
                    		bHeadlightsOn = true;
                    		if(DamageMaterialInstance[0] != None)
                    		{
                    			DamageMaterialInstance[0].SetScalarParameterValue(HeadLightParameterName, 100.0 );
                    		}
                    	}
                    	
                    	if (health <150)
                    	       {
                                       maxspeed = 500;
                                   }
                    }
                    this will give you the revs and speed of the car.

                    does any one know anything about the steering wheel? i cant stop it from taking damage,as you can see in the vid.this problem has plagued me for a long time.

                    Comment


                      #55


                      a flying lap of donnington in the aventador.i needed a decent track to test the car in and the results are pretty good.it shouldnt take long to fill the map in.

                      download the lambo here

                      http://www.mediafire.com/download/ju..._aventador.zip


                      most of it is working right but there will be updates when I get more time.

                      everyone,if you have a logo you want next to the track just post it here and I will add it.

                      tegleg,any tips on using your race pathnodes?should they be really close too each other to get the best results.

                      edit: I tried over and over to get rid of that kink in the back end but only managed to make it worse.lesson learned.no more triangles in the mesh.

                      Comment


                        #56
                        have the nodes about 3 or 4 car lengths apart on a medium corner, closer on really tight corners, further apart on long corners. on straights, space them unevenly, even spacing gives them the wobbles. apart from that, experiment

                        id also like to thank you for giving away your 206, after possibly weeks of trying to get the damage springs to work on my car i decided to look at and copy yours. i dont know what i missed before (possibly something in the animtree or physics asset) but it works now thanks

                        the gearbox has been put back a bit while i work on other things but it will be ready at some point.

                        keep it up your cars look ace fun

                        Comment


                          #57
                          since then ive found the other race ia you posted and its working fantastically well.i had placed the racenodes on the racing line at quite small intervals,559 around donnington.
                          after getting the race ai to run backwards(because udk renames previous pathnodes when copied so the order was 559-0)its all good.

                          ive got the bots to go to the pit lane when they are damaged for repair and I can monitor theirs and my track position using foreach and VSize2d to get the nearest node.

                          im struggling with an array to sort the track position data into first,second and third but apart from that ive accidentally built a very satisfying racing game that almost feels like an early codemasters game.

                          new vid soon and demo too.now ive got to make some competition for the lambo.

                          and thanks for all of your code I keep finding.

                          Comment


                            #58
                            Like the car stuff your doing gaz661, do you have a video tutorial on how to get a car in game?

                            Comment


                              #59
                              thanks.these are the tuts I used and cover all the basics.

                              https://forums.epicgames.com/threads...Tutorials-List

                              Comment


                                #60


                                this is where im at.

                                ive tweeked teglegs race ai and race pathnodes to give some variation on the speed and actuall location of the race node,so no more f1 type procession races.
                                ive added a fuel var so longer races become interesting even if(in the unlikely event) no one crashes.
                                mirrors are starting to become expensive.without mirrors I get 60 fps with 11 cars all round the track.with mirrors the frame rate drops to 45 in 2 places on the track,and I imagine it will only get worse.

                                Comment

                                Working...
                                X