Announcement

Collapse
No announcement yet.

Relative Physics Problem

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

  • replied
    Thanks. If you have any feedback, comment or suggestion feel free to let me know. Not here, but in my Work in Progress Thread linked to in my signature, since this not the place to discuss my game. ;-)

    Please PM me when you have something to show on your project's progress. I am always curious what developer's of space games do.

    Leave a comment:


  • replied
    Hey man, sorry for the long reply, just got back from work My project is solely a single-player game, the multiplayer aspects would definately be a bit too much for me at the moment, it is something ala-Frontier Elite/Freelancer for my final project at uni, my main project goals at the bare minimum (to stay realistic in my short time frame through my final year) are reasonably tight flying/pewpew mechanics and hopefully some docking/trading/repair between a couple of stations.

    If things go much better than expected then within that, during my games level(s), for progression I want to have some scripted events that have the player having to do a trade run or two, fight enemies(fighters/bomber class), destroy a capital ship by taking out its engines (or something to that effect) to make it exciting for my final showcase. Once uni is out the way in June/July I'll probably then be looking to expand greatly upon the game with good narrative and story to really hammer out the exploration aspect of my game.

    Thanks for the reply btw, your space shooter WIP looks incredible! I'm also pretty gutted tbh as you seem to be achieving what I've been dreaming of making for so long haha, your work is really ******* good.

    Leave a comment:


  • replied
    For the mouse: I haven't changed my inis for the mouse at all.

    The bindings doing the magic are in UDKInput.ini, section [Engine.PlayerInput]:
    Bindings=(Name="MouseX",Command="Count bXAxis | Axis aMouseX")
    Bindings=(Name="MouseY",Command="Count bYAxis | Axis aMouseY")

    I should be honest about this, I have never accessed the mouse in singleplayer only coding, went straight for multiplayer. That's why I am not sure if it works the way you try it to do. Logging is the way to go to figure this out.

    For the additional buttons:
    Are you aiming for single or multiplayer?

    If you are fine with a singleplayer game it is less work to do, but getting the multiplayer working later on is a very big load of work.

    Why am I asking whether multiplayer or singleplayer?

    Multiplayer coding makes things at least 4 times more difficult, especially for a beginner, since you have to take care to syncronize values and reduce bandwith usage.

    So what will it be? MP or SP? Beware that I won't help you with multiplayer issuse unrelated with the input for ship, because this a complex topic on its on. Although I might provide links to some tutorials. ;-)

    Leave a comment:


  • replied
    Hokay I'm really struggling getting the mouse code on the previous page to work, so as it stands I'm short 2 keys

    Code:
    // Roll
    // No rolling for now, I will use q and e for the forward movement for the time being
    AR_ForceRotationVectX *= 110 * -AR_NewRise; // AR_NewRise is between -1 and 1
    
    // Pitch
    AR_ForceRotationVectY *= 90 * Throttle; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= 110 * -Steering; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 505 * AR_NewRise * AR_ForwardsNormal;
    Code:
    // Roll
    // No rolling for now, I will use q and e for the forward movement for the time being
    AR_ForceRotationVectX *= 110 * -Steering; // AR_NewRise is between -1 and 1
    
    // Pitch
    AR_ForceRotationVectY *= PlayerController(Controller).PlayerInput.aMouseY; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= PlayerController(Controller).PlayerInput.aMouseX; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_ForwardsNormal * Throttle * 505;
    Using the mouse code from the previous page I have the same problem as KongWeeZy where it just does not respond at all to mouse movement. I've tried to add them as binds in DefaultInput.ini but also to no avail, really struggling here, tried to find where Throttle, Steering and Rise are defined as well so I could perhaps add an extra one for Z and X or something just so I can get it all working together.

    EDIT: The mouse X and Y binds are in UDKInput.ini but missing from defaultinput.ini, not too sure where to add them in defaultinput.ini to activate? them.

    All in all, whatever combination I use (minus the 2 buttons) works great except without the missing 2 buttons I am either spinning/rotating/or left dead in the air (with full movement).

    Thanks for taking the time to read this!

    Leave a comment:


  • replied
    Ahh that makes sense, thanks a lot man! Tbf I should have realised that lol xD
    Right now I'm tightening up all the values so its nice and responsive which is going great, this is some excellent code!

    Utilising a chase cam with some snippets from the cicada code I've got it 'chasing' in full 360degree movement and really gives that sense of movement similar to Freelancer/Frontier Elite which is what I was gunning for with this project I'm working on!

    I've unlocked the Roll as well so now I'm tackling with getting my head around the keybinds since Roll has replaced the accelerate and decelerate on Space and C, bit of trial and error though and all should be good ^_^

    Leave a comment:


  • replied
    The reason why you had to use exaggerated values is simple.

    The mass of any rigid body, including your custom vehicle and the cicada, is based on its volume. The more volume (the bigger your vehicle) is, the more force you need to to move it.

    Just imagine you would try to push a book of a desk. Easy, right?
    Now imagine to push a car out of a garage. Although your are using roughly the same amount of force, the effect is vastly different.

    Every ship/plane needs its own values.
    The values I provided are aimed for a slow moving cicada.

    Leave a comment:


  • replied
    FIXED For some reason I need to use greatly exaggerated values :3 That break in the day really helped me get a clear perspective woohoo!

    Leave a comment:


  • replied
    Wow firstly, thanks to everyone in this thread, I have managed to get it in my game and 'semi-working' however it appears to turn very very slowly (whether using W,S or A,D), Space and C affect the speed quite fast, Ill add in all my code now if someone could quickly peruse it

    I did have my own custom models and everything in there but they were causing more problems than solving so following what others said in here, I swapped over to referencing the Cicada in the code.

    UTVehicle_PulseTest2.uc (AR_Aircraft.uc)

    Code:
    class UTVehicle_PulseTest2 extends UTAirVehicle;
    
    /* etc */
    
    var float AR_MaxLift, AR_TurnSpeed, AR_Speed, AR_CurrentForward, 
    
    AR_AddedLiftSpeed, AR_Acceleration;
    
    /* etc */
    
    simulated function AirRaidKinematics(float DeltaTime)
    {
    local Vector AR_ForceApplication, AR_ForceRotation, AR_ForwardsNormal, 
    
    AR_UpwardsNormal, AR_SidewardsNormal;
    local Vector AR_ForceRotationVectX, AR_ForceRotationVectY, 
    
    AR_ForceRotationVectZ;
    local float AR_NewRise;
    
    // While there is a player in the biplane:
    if (PlayerController(Controller) != None)
    {
    GetAxes(Rotation, AR_ForwardsNormal, AR_SidewardsNormal, 
    
    AR_UpwardsNormal);
    
    // It's probably unnecessary to normalise these:
    AR_ForceRotationVectX = Normal(AR_ForwardsNormal);
    AR_ForceRotationVectY = Normal(AR_SidewardsNormal);
    AR_ForceRotationVectZ = Normal(AR_UpwardsNormal);
    
    // Rise is NOT between -1 and 1, like it said it was
    AR_NewRise = 0;
    if (Rise != 0) AR_NewRise = Rise / Abs(Rise); // Avoid divide by 0
    
    // Calculate the XYZ components of the relative steering:
    // Generic controls Steering, Throttle and Rise are set by the controller
    
    // Roll
    // No rolling for now, I will use q and e for the forward movement for 
    
    the time being
    // AR_ForceRotationVectX *= 35 * -AR_NewRise; // AR_NewRise is between -1 
    
    and 1
    
    // Pitch
    AR_ForceRotationVectY *= 30 * Throttle; // Throttle is between -1 and 1
    
    // Yaw
    AR_ForceRotationVectZ *= 25 * -Steering; // Steering is between -1 and 1
    
    // Add them together to get final global rotation vector:
    AR_ForceRotation = AR_ForceRotationVectX + AR_ForceRotationVectY + 
    
    AR_ForceRotationVectZ;
    
    // The magic happens here
    AR_ForceApplication = AR_UpwardsNormal * 0 + 50 * AR_NewRise * 
    
    AR_ForwardsNormal;
    
    // Add forces and rotations
    Mesh.AddForce(AR_ForceApplication);
    Mesh.AddTorque(AR_ForceRotation);
    }
    else
    {
    // if nobody is in the plane, don't apply forces to it, do nothing
    }
    }
    
    
    simulated function Tick(float DeltaTime)
    {
    AirRaidKinematics(DeltaTime);
    Super.Tick(DeltaTime);
    }
    
    /* etc */
    UTVehicleFactor_PulseTest2

    Code:
    class UTVehicleFactory_PulseTest2 extends UTVehicleFactory placeable;
    
    defaultproperties
    {
    	Begin Object Name=SVehicleMesh
    		SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cicada'
    		Translation=(X=-40.0,Y=0.0,Z=-70.0)
    	End Object
    
    
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+120.0
    		CollisionRadius=+200.0
    		Translation=(X=0.0,Y=0.0,Z=-40.0)
    	End Object
    
    	VehicleClassPath="UTGameContent.UTVehicle_PulseTest_Content2"
    	DrawScale=1
    }
    UT_Vehicle_PulseTest_Content2.uc

    Code:
    class UTVehicle_PulseTest_Content2 extends UTVehicle_PulseTest2;
    
    var array<UTDecoy> Decoys;
    
    simulated function PostBeginPlay()
    {
    	Super.PostBeginPlay();
    }
    
    function IncomingMissile(Projectile P)
    {
    	local UTVWeap_CicadaTurret Turret;
    
    	// notify the turret weapon
    	if (Seats.length > 1)
    	{
    		Turret = UTVWeap_CicadaTurret(Seats[1].Gun);
    		if (Turret != None)
    		{
    			Turret.IncomingMissile(P);
    		}
    	}
    
    	Super.IncomingMissile(P);
    }
    
    defaultproperties
    {
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+70.0
    		CollisionRadius=+240.0
    		Translation=(X=-40.0,Y=0.0,Z=40.0)
    	End Object
    
    	Begin Object Name=SVehicleMesh
    		SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cicada'
    		AnimTreeTemplate=AnimTree'VH_Cicada.Anims.AT_VH_Cicada'
    		
    
    PhysicsAsset=PhysicsAsset'VH_Cicada.Mesh.SK_VH_Cicada_Physics'
    		AnimSets.Add(AnimSet'VH_Cicada.Anims.VH_Cicada_Anims')
    	End Object
    
    	DrawScale=1.3
    
    	Health=500
    	BigExplosionTemplates[0]=
    
    (Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Far',Min
    
    Distance=350)
    	BigExplosionTemplates[1]=
    
    (Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near')
    	BigExplosionSocket=VH_Death
    
    	Seats.Empty
    	Seats(0)={(	GunClass=class'UTVWeap_CicadaMissileLauncher',
    				GunSocket=(Gun_Socket_02,Gun_Socket_01),
    				CameraTag=ViewSocket,
    				TurretControls=(LauncherA,LauncherB),
    				CameraOffset=-400,
    				CameraBaseOffset=(Z=25.0),
    				SeatIconPos=(X=0.48,Y=0.25),
    				GunPivotPoints=(Main),
    				WeaponEffects=
    
    ((SocketName=Gun_Socket_01,Offset=(X=-80),Scale3D=
    
    (X=12.0,Y=15.0,Z=15.0)),(SocketName=Gun_Socket_02,Offset=(X=-
    
    80),Scale3D=(X=12.0,Y=15.0,Z=15.0)))
    				)}
    
    	Seats(1)={(	GunClass=class'UTVWeap_CicadaTurret',
    				GunSocket=
    
    (Turret_Gun_Socket_01,Turret_Gun_Socket_02,Turret_Gun_Socket_03,Turret_Gu
    
    n_Socket_04),
    				TurretVarPrefix="Turret",
    				TurretControls=(Turret_Rotate),
    				CameraTag=Turret_ViewSocket,
    				CameraOffset=0,
    				GunPivotPoints=(MainTurret_Pitch),
    				CameraEyeHeight=0,
    				SeatIconPos=(X=0.48,Y=0.56),
    				ViewPitchMin=-14000.0,
    				ViewPitchMax=1.0,
    				WeaponEffects=
    
    ((SocketName=Turret_Gun_Socket_04,Offset=(X=-80),Scale3D=
    
    (X=8.0,Y=10.0,Z=10.0)),(SocketName=Turret_Gun_Socket_03,Offset=(X=-
    
    80),Scale3D=(X=8.0,Y=10.0,Z=10.0)))
    				)}
    
    
    	
    
    TurretBeamTemplate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndPrim_B
    
    eam'
    
    	VehicleEffects.Empty
    	
    	VehicleEffects(0)=
    
    (EffectStartTag=TurretWeapon00,EffectEndTag=STOP_TurretWeapon00,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_01)
    	VehicleEffects(1)=
    
    (EffectStartTag=TurretWeapon01,EffectEndTag=STOP_TurretWeapon01,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_02)
    	VehicleEffects(2)=
    
    (EffectStartTag=TurretWeapon02,EffectEndTag=STOP_TurretWeapon02,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_03)
    	VehicleEffects(3)=
    
    (EffectStartTag=TurretWeapon03,EffectEndTag=STOP_TurretWeapon03,EffectTem
    
    plate=ParticleSystem'VH_Cicada.Effects.P_VH_Cicada_2ndAltFlash',EffectSoc
    
    ket=Turret_Gun_Socket_04)
    
    	VehicleEffects(4)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_GroundEffect',EffectSocket=GroundE
    
    ffectBase)
    	VehicleEffects(5)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_Exhaust',EffectSocket=LeftExhaust)
    	VehicleEffects(6)=
    
    (EffectStartTag=EngineStart,EffectEndTag=EngineStop,EffectTemplate=Partic
    
    leSystem'VH_Cicada.Effects.P_VH_Cicada_Exhaust',EffectSocket=RightExhaust
    
    )
    	VehicleEffects(7)=
    
    (EffectStartTag=DamageSmoke,EffectEndTag=NoDamageSmoke,bRestartRunning=fa
    
    lse,EffectTemplate=ParticleSystem'Envy_Effects.Vehicle_Damage.P_Vehicle_D
    
    amage_1_Cicada',EffectSocket=DamageSmoke_01)
    
    	VehicleAnims(0)=(AnimTag=Created,AnimSeqs=
    
    (InActiveStill),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=Cicada
    
    Player)
    	VehicleAnims(1)=(AnimTag=EngineStart,AnimSeqs=
    
    (GetIn),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=CicadaPlayer)
    	VehicleAnims(2)=(AnimTag=Idle,AnimSeqs=
    
    (Idle),AnimRate=1.0,bAnimLoopLastSeq=true,AnimPlayerName=CicadaPlayer)
    	VehicleAnims(3)=(AnimTag=EngineStop,AnimSeqs=
    
    (GetOut),AnimRate=1.0,bAnimLoopLastSeq=false,AnimPlayerName=CicadaPlayer)
    
    	JetEffectIndices=(11,12)
    	ContrailEffectIndices=(2,3,4,5,13,14)
    	GroundEffectIndices=(10)
    
    	// Sounds
    	// Engine sound.
    	Begin Object Class=AudioComponent Name=RaptorEngineSound
    		
    
    SoundCue=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_EngineLoop'
    	End Object
    	EngineSound=RaptorEngineSound
    	Components.Add(RaptorEngineSound);
    
    	
    
    CollisionSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Colli
    
    de'
    	
    
    EnterVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_St
    
    art'
    	
    
    ExitVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Sto
    
    p'
    
    	// Scrape sound.
    	Begin Object Class=AudioComponent Name=BaseScrapeSound
    		
    
    SoundCue=SoundCue'A_Gameplay.A_Gameplay_Onslaught_MetalScrape01Cue'
    	End Object
    	ScrapeSound=BaseScrapeSound
    	Components.Add(BaseScrapeSound);
    
    	// Initialize sound parameters.
    	EngineStartOffsetSecs=2.0
    	EngineStopOffsetSecs=1.0
    
    	IconCoords=(U=988,V=0,UL=33,VL=42)
    
    	
    
    ExplosionSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Explo
    
    de'
    	JetScalingParam=JetScale
    
    	PassengerTeamBeaconOffset=(X=-125.0f,Y=0.0f,Z=-105.0f);
    	
    
    ReferenceMovementMesh=StaticMesh'Envy_Effects.Mesh.S_Air_Wind_Ball'
    
    	HudCoords=(U=106,V=125,UL=-106,VL=124)
    	TeamMaterials[0]
    
    =MaterialInstanceConstant'VH_Cicada.Materials.MI_VH_Cicada_Red'
    	TeamMaterials[1]
    
    =MaterialInstanceConstant'VH_Cicada.Materials.MI_VH_Cicada_Blue'
    
    	BurnOutMaterial[0]
    
    =MaterialInterface'VH_Cicada.Materials.MITV_VH_Cicada_Red_BO'
    	BurnOutMaterial[1]
    
    =MaterialInterface'VH_Cicada.Materials.MITV_VH_Cicada_Blue_BO'
    
    	SpawnMaterialLists[0]=(Materials=
    
    (MaterialInterface'VH_Cicada.Materials.MI_VH_Cicada_Spawn_Red'))
    	SpawnMaterialLists[1]=(Materials=
    
    (MaterialInterface'VH_Cicada.Materials.MI_VH_Cicada_Spawn_Blue'))
    
    	DamageMorphTargets(0)=
    
    (InfluenceBone=Lt_Gun_Yaw,MorphNodeName=none,Health=150,DamagePropNames=
    
    (Damage2))
    	DamageMorphTargets(1)=
    
    (InfluenceBone=Rt_Gun_Yaw,MorphNodeName=none,Health=150,DamagePropNames=
    
    (Damage2))
    	DamageMorphTargets(2)=
    
    (InfluenceBone=FrontGuardDamage,MorphNodeName=none,Health=150,DamagePropN
    
    ames=(Damage1))
    	DamageMorphTargets(3)=
    
    (InfluenceBone=MainTurret_Yaw,MorphNodeName=none,Health=150,DamagePropNam
    
    es=(Damage3))
    
    	DamageParamScaleLevels(0)=(DamageParamName=Damage1,Scale=3)
    	DamageParamScaleLevels(1)=(DamageParamName=Damage2,Scale=1.5)
    	DamageParamScaleLevels(2)=(DamageParamName=Damage3,Scale=2.5)
    
    	
    
    DrivingPhysicalMaterial=PhysicalMaterial'VH_Cicada.materials.physmat_Cica
    
    da_driving'
    	
    
    DefaultPhysicalMaterial=PhysicalMaterial'VH_Cicada.materials.physmat_Cica
    
    da'
    
    	bHasEnemyVehicleSound=true
    	EnemyVehicleSound(0)
    
    =SoundNodeWave'A_Character_IGMale.BotStatus.A_BotStatus_IGMale_EnemyCicad
    
    a'
    }
    I have to get to class now or I would upload a vid, its clear how it should be moving, just the WASD keys are very slow to respond (in both default and edited gravity volume, as suggested)

    Using Space and C I can accelerate forwards and back quite quickly if it is set to 500.

    It was working quite well with the custom model/setup I had for my modification of the Cicada script except it was spinning round endlessly, I could combat this but it would then be going in the opposite direction quite quickly meaning it was very very sensitive. I'm wondering if that was due to scale/bone setup or something.

    Anyways thanks again for the work in here and for any replies

    Leave a comment:


  • replied
    Haha, I was afraid of that, interesting about not taking pitch into consideration. I'll focus on what I can do with the design and art side of things for now, thanks.

    Leave a comment:


  • replied
    I see what you want to do. The problem is as following:

    The whole UT-Code shipped with UDK is designed for a classic FPS. Meaning features like planes flying upside down or tilting a vehicle were not considered to be needed during development, because 99 % of FPSs do not need such features and those make the code a lot more complex.
    In conclusion there is no easy way of achieving what you are after. It is possible, about medium difficultiy, but you have to code EVERYTHING yourself. Including the lockSteer for Yaw and Pitch, because the UT-Code considers only yaw rotation as valid player input and is basicly impossible to extend/modify. On top of that you have to understand how forces are used to move the cicada the way you want to. Don't forget vector math.
    But don't let me stop you, just be aware that it is not an easy task for a beginner and will take some time. Go ahead and make something epic. ;-)

    Leave a comment:


  • replied
    Sure, thanks I figured it wouldn't be as easy as copying one of their vehicle scripts, thought it would be a good start though to see how things are done though.

    With the Cicada and Manta the vehicle's strafing and throttle are controlled with the keyboard while the player can freely look around using the mouse, with the vehicle's yaw following the camera view, slightly lagging behind. I've recorded a quick video of the Cicada here:


    I'm looking for a similar effect but with the vehicle's pitch as well. After some digging around I've found the following input code with something relevant to the LookSteer in the UTVehicle.uc, I might tinker about with it a bit and see what happens.

    Code:
    simulated function SetInputs(float InForward, float InStrafe, float InUp)
    {
    	local bool bReverseThrottle;
    	local UTConsolePlayerController ConsolePC;
    	local rotator SteerRot, VehicleRot;
    	local vector SteerDir, VehicleDir, AngVel;
    	local float VehicleHeading, SteerHeading, DeltaTargetHeading, Deflection;
    
    	Throttle = InForward;
    	Steering = InStrafe;
    	Rise = InUp;
    
    	ConsolePC = UTConsolePlayerController(Controller);
    	if (ConsolePC != None)
    	{
    		Steering = FClamp(Steering * ConsoleSteerScale, -1.0, 1.0);
    
    		UpdateLookSteerStatus();
    
    		// tank, wheeled / heavy vehicles will use this
    
    		// If we desire 'look steering' on this vehicle, do it here.
    		if (bUsingLookSteer && IsHumanControlled())
    		{
    			// If there is a deflection, look at the angle that its point in.
    			Deflection = Sqrt(Throttle*Throttle + Steering*Steering);
    
    			if(bStickDeflectionThrottle)
    			{
    				// The region we consider 'reverse' is anything below DeflectionReverseThresh, or anything withing the triangle below the center position.
    				bReverseThrottle = ((Throttle < DeflectionReverseThresh) || (Throttle < 0.0 && Abs(Steering) < -Throttle));
    				Throttle = Deflection;
    
    				if (bReverseThrottle)
    				{
    					Throttle *= -1;
    				}
    			}
    
    			VehicleRot.Yaw = Rotation.Yaw;
    			VehicleDir = vector(VehicleRot);
    
    			SteerRot.Yaw = DriverViewYaw;
    			SteerDir = vector(SteerRot);
    
    			VehicleHeading = GetHeadingAngle(VehicleDir);
    			SteerHeading = GetHeadingAngle(SteerDir);
    			DeltaTargetHeading = FindDeltaAngle(SteerHeading, VehicleHeading);
    
    			if (DeltaTargetHeading > LookSteerDeadZone)
    			{
    				Steering = FMin((DeltaTargetHeading - LookSteerDeadZone) * LookSteerSensitivity, 1.0);
    			}
    			else if (DeltaTargetHeading < -LookSteerDeadZone)
    			{
    				Steering = FMax((DeltaTargetHeading + LookSteerDeadZone) * LookSteerSensitivity, -1.0);
    			}
    			else
    			{
    				Steering = 0.0;
    			}
    
    			AngVel = Mesh.BodyInstance.GetUnrealWorldAngularVelocity();
    
    			Steering = FClamp(Steering + (AngVel.Z * LookSteerDamping), -1.0, 1.0);
    
    			// Reverse steering when reversing
    			if (Throttle < 0.0 && ForwardVel < 0.0)
    			{
    				Steering = -1.0 * Steering;
    			}
    		}
    		// flying hovering vehicles will use this
    		else
    		{
    			//`log( " flying hovering vehicle" );
    			if (bStickDeflectionThrottle)
    			{
    				// The region we consider 'reverse' is anything below DeflectionReverseThresh, or anything withing the triangle below the center position.
    				bReverseThrottle = ((Throttle < DeflectionReverseThresh) || (Throttle < 0.0 && Abs(Steering) < -Throttle));
    
    				Deflection = Sqrt(Throttle*Throttle + Steering*Steering);
    				Throttle = Deflection;
    
    				if (bReverseThrottle)
    				{
    					Throttle *= -1;
    				}
    			}
    		}
    
    		//`log( "Throttle: " $ Throttle $ " Steering: " $ Steering );
    	}
    }

    Leave a comment:


  • replied
    Please give me a short description of what lookSteer does/you want to archieve. I haven't used it, since I haven't bothered much with default vehicle controls. They are simply not meant to be used for a space/flight vehicle.

    Leave a comment:


  • replied
    Hey, I wanted to say a big thanks to those sharing their scripting knowledge in this thread, it's been a massive help for an unrealscript noob like me experimenting with vehicle controls. Out of curiosity: has anyone had any luck playing around with getting "lookSteer" similar to that on the Cicada working on both the vehicle's Yaw and the vehicle's Pitch? I've been struggling with this for a few days now, and the best I've managed was having the vehicle spinning on the spot nose down. :P

    Leave a comment:


  • replied
    I haven't binded the MouseX/MouseY in my DefaultInput.ini at all. They are binded by default as far as I know.

    By the way there is a small mistakte in the bindings you posted:

    Bindings = (Name = "MouseX", Command = "Count bYAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")

    should be

    Bindings = (Name = "MouseX", Command = "Count bXAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")

    If removing the bindings from the DefaultInput.ini (if they are even there, don't remove them from UDKInput.ini) doesn't help, try logging to figure out the mistake.

    On top of that you might try to remove the "/100". The calculated values might be just to small.^^

    Code:
    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY;
    
    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX;
    
    `log("MOUSEX: "$PlayerController(Controller).PlayerInput.aMouseX);
    `log("MOUSEY: "$PlayerController(Controller).PlayerInput.aMouseY);
    If the values in your logging window are all 0 when you are moving the mouse, you are in trouble.^^
    If it works, remove the `log.


    [EDIT] Although you said spaceship, don't you mean plane? Because you asked how to fix/add gravity to the spacehsip. Spaceships aren't affected by earth's gravity since they are in space^^

    For a plane I would recommend a key layout as following:

    Roll with A/D (Steering),
    Pitch with W/S (Throttle),
    Forward/backward: Space/C (AR_NewRise) and a default forward speed

    Code:
    // Roll
    PZ_ForceRotationVectX *= 30* Steering; // you might want to play with 30
    
    // Pitch
    PZ_ForceRotationVectY *= 30 * Throttle;
    
    // No Yaw turning, planes turn mostly by a combination of roll and pitch, so let's ignore it for now
    PZ_ForceRotationVectZ *= 0;
    
    // The magic happens here ---- Forward
    PZ_ForceApplication = PZ_ForwardsNormal * (AR_NewRise+1)* 6000;
    This would result in a nice plane, that still isn't affected by gravity. If you want gravity, you have to consider (air) lift and drag forces as well. I can go into that after we have figured out your input issue.

    Leave a comment:


  • replied
    I do not know what I'm doing wrong, but it does not work ... I have tried and bind buttons

    Bindings = (Name = "MouseX", Command = "Count bYAxis | Axis aMouseX")
    Bindings = (Name = "MouseY", Command = "Count bYAxis | Axis aMouseY")


    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY / 100;

    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX / 100;

    the debugging, does not fail, but nothing happens, when I use the mouse...




    Nice code..
    PZ_ForceApplication = PZ_ForwardsNormal * (Throttle+1) * 6000;

    Leave a comment:

Working...
X