Announcement

Collapse
No announcement yet.

Relative Physics Problem

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

  • replied
    Hi.
    It work good for the cicada.
    I have create a viper but he can't move.
    Maybe I have forgotten a bone?
    Can you help me please.
    Thanks.

    Leave a comment:


  • replied
    Glad to be of help.

    Leave a comment:


  • replied
    I fixed it, there was a problem with the kill zone that I thought was changed but it wasn't and I didn't realize what was going on until I started trying to simulate the problem a bunch to make a video to show you. Sooo I guess you fixed it

    Leave a comment:


  • replied
    Does it really blow up? Or does the mesh just disappear? In that case your RootBone has lost its in health in the AnimTree.
    As the problem properly lies somewhere else, could you upload a video of what you have to do to make your ship explode? Perhaps this will give me an idea. At least I will try to reproduce the steps in my game to check if I've got the same bug.

    Leave a comment:


  • replied
    Has anyone here had the problem of their vehicle just randomly blowing up sometimes? I can recreate it more often if I fly my space ship in a head over heels rolling type of way where I just keep changing the pitch and then it blows up. I'm flying in 0 gravity and my ship is extending off the UTAirVehicle. However sometimes its blown up when I'm not near anything and I'm only flying straight. It doesn't detect any bump,touch, or collision when it blows up and gives no log, it also has like 10k health and takes no damage when it blows up. Does anyone know anything about this?

    Leave a comment:


  • replied
    ya its already set up for that I just didn't know the syntax for it to actually get those variables to the server but someone answered my other post about it so no worries it works now.

    In case anyone in the future comes here looking just change your 'simulated function' that handles those variables to 'reliable server simulated function'.

    Leave a comment:


  • replied
    The server should not listen directly to mousex and mousey. Use other variables, preferrably of the ship, to replicate the input. In other words: your ship should have some variable that the controller stores the mousex and y input in. These variables are replicated to the server and the server updates the ships rotation on each frame based on them.

    Leave a comment:


  • replied
    Originally posted by Hiredicespecter View Post
    I suggest that you use the mouse for turning to free keys. The following code will ONLY work in single player.

    Code:
    // Roll
    PZ_ForceRotationVectX *= 800 * Rise; // PZ_NewRise is between -1 and 1
    
    // Pitch
    PZ_ForceRotationVectY *= 30 * -PlayerController(Controller).PlayerInput.aMouseY / 100;
    
    // Yaw
    PZ_ForceRotationVectZ *= 30 * PlayerController(Controller).PlayerInput.aMouseX / 100;
    
    // The magic happens here ---- Forward
    PZ_ForceApplication = PZ_ForwardsNormal * Throttle * 6000;
    I got this all to work and even added my own camera controls like one that unlocks and fully rotates around the ship, zooms, changes to a different view etc. Right now I'm trying to put it online and you're right the ship doesn't pitch or yaw now with this code, I'm sending it straight from the player controller as well which you suggested in one of your other posts. How would I get the ship to pitch and yaw with the mousex and mousey input in a multiplayer setting? I've read up a lot on replicationg but I still can't seem to get the server to listen to the mousex and mousey input of the client no matter what I try(it does listen if its just the camera though but it won't move the ship).

    Leave a comment:


  • replied
    Ya I've spent the past day looking through those files and have finally wrapped my head around it. The reason I wasn't getting it to work on my end was I wasn't calling the playercontroller class properly in my gamesetup class which someone else pointed out in another thread. Thanks for the response though, your code is the only way I was able to understand all the ship controls in the first place

    Leave a comment:


  • replied
    GBA_FeignDeath is not a function in the source code, but an input macro/binding in the configuration files.

    You can make functions accessible for the console and player input with the keyword exec.

    More details:

    http://udn.epicgames.com/Three/ConfigurationFiles.html
    http://udn.epicgames.com/Three/ExecFunctions.html
    http://udn.epicgames.com/Three/KeyBinds.html

    Leave a comment:


  • replied
    This thread/community is awesome, was able to get a working space ship going in a couple hours after reading the problems others already had (and an hour of bug fixing/tweaking of my own), so much good help here.

    One thing I'm still not getting completely is the key binding though, it seems as though the Command never gets referenced again such as GBA_FeignDeath or at least I can't find where it gets used. I got my ship rolling with W and D and going forward with spacebar but I want to add verticle take off and landing functions without replacing any keys so i was thinking about adding the R and F keys.

    I'm not sure the best way to reference this, also I would like to put my little project online within the next couple weeks so I'm looking for a multiplier solution. Any help would be really appreciated. Thanks!

    Leave a comment:


  • replied
    On page 8 Roonast posted a working snippet. He left out the default properties of UTVehicle_PulseTest2. Just use the ones from the cicada.
    http://forums.epicgames.com/threads/...1#post29674407

    Basically you have to replace your tick function in Su24.uc and copy the function AirRaidKinematics and related variables to your file.

    Su24Factory.uc code looks fine.

    Su24_Content.uc looks fine as well, except I'd merge the two default properties blocks.

    Leave a comment:


  • replied
    My plane(is a Su24) acts like a baloon, and probably because I did a lot of mistakes could you take a look to this 3 codes and help me please:
    Su24.uc
    Code:
    /**
     * Copyright 1998-2012 Epic Games, Inc. All Rights Reserved.
     */
    class Su24 extends UTAirVehicle
    	abstract;
    
    var repnotify vector TurretFlashLocation;
    var repnotify rotator TurretWeaponRotation;
    var	repnotify byte TurretFlashCount;
    var repnotify byte TurretFiringMode;
    
    var bool bFreelanceStart;
    
    var array<int> JetEffectIndices;
    
    var ParticleSystem TurretBeamTemplate;
    
    var UTSkelControl_JetThruster JetControl;
    
    var name JetScalingParam;
    
    replication
    {
    	if (bNetDirty)
    		TurretFlashLocation;
    
    	if (!IsSeatControllerReplicationViewer(1) || bDemoRecording)
    		TurretFlashCount, TurretFiringMode, TurretWeaponRotation;
    }
    
    event Tick(float DeltaTime)
    {
    	local UTBot Bot;
    	local float JetScale;
    	local int i, JetIndex;
    	local vector HitLocation, HitNormal;
    	local actor HitActor;
    	
    	super.tick(DeltaTime);
    
    	if ( bDriving )
    	{
    		if ( Controller == None ) 
    		{
    			if (Seats.Length > 1 && Seats[1].SeatPawn != None && Seats[1].SeatPawn.Controller != None && (Location.Z < WorldInfo.StallZ) )
    			{
    				// if turret passenger, try to bring vehicle to a halt
    				Rise = FClamp((-1.0 * Velocity.Z)/GetMaxRiseForce(), -1.0, 1.0);
    			}
    		}
    		else 
    		{
    			// AI altitude control
    			Bot = UTBot(Controller);
    			if ( Bot != None )
    			{
    				if ( Bot.bScriptedFrozen )
    				{
    					Rise = FClamp((-1.0 * Velocity.Z) / GetMaxRiseForce(), 0.0, 1.0);
    				}
    				else if ( !Bot.InLatentExecution(Bot.LATENT_MOVETOWARD) )
    				{
    					if (Rise < 0.0)
    					{
    						if (Velocity.Z < 0.0)
    						{
    							if (Velocity.Z < -1000.0)
    							{
    								Rise = -0.001;
    							}
    							HitActor = Trace(HitLocation, HitNormal, Location - vect(0.0, 0.0, 2000.0), Location, FALSE);
    							if (HitActor != None)
    							{
    								if ((Location.Z - HitLocation.Z) / (-1.0 * Velocity.Z) < 0.85)
    								{
    									Rise = 1.0;
    								}
    							}
    						}
    					}
    					else if (Rise == 0.0)
    					{
    						if ( !FastTrace(Location - vect(0.0, 0.0, 500.0), Location) )
    						{
    							Rise = FClamp((-1.0 * Velocity.Z) / GetMaxRiseForce(), 0.0, 1.0);
    						}
    					}
    				}
    			}
    		}
    	}
    
    	if ( LastRenderTime > WorldInfo.TimeSeconds - 0.2 )
    	{
    		if ( JetControl != None )
    		{
    			JetScale = FClamp(1.0-JetControl.ControlStrength, 0.2 , 1.0);
    			for ( i=0; i<JetEffectIndices.Length; i++ )
    			{
    				JetIndex = JetEffectIndices[i];
    				if ( JetIndex < VehicleEffects.Length && (VehicleEffects[JetIndex].EffectRef != None) )
    				{
    					VehicleEffects[JetIndex].EffectRef.SetFloatParameter(JetScalingParam, JetScale);
    				}
    			}
    		}
    	}
    }
    
    
    simulated event RigidBodyCollision( PrimitiveComponent HitComponent, PrimitiveComponent OtherComponent,
    					const out CollisionImpactData RigidCollisionData, int ContactIndex )
    {
    	Super.RigidBodyCollision(HitComponent, OtherComponent, RigidCollisionData, ContactIndex);
    	if(!IsTimerActive('ResetTurningSpeed'))
    	{
    		SetTimer(0.7f,false,'ResetTurningSpeed');
    		MaxSpeed = default.MaxSpeed/2.0;
    		MaxAngularVelocity = default.MaxAngularVelocity/4.0;
    		if( UDKVehicleSimChopper(SimObj) != none)
    			UDKVehicleSimChopper(SimObj).bRecentlyHit = true;
    	}
    }
    
    simulated function ResetTurningSpeed()
    { // this is safe since this only gets called above after checking SimObj is a chopper.
    	MaxSpeed = default.MaxSpeed;
    	MaxAngularVelocity = default.MaxAngularVelocity;
    	if( UDKVehicleSimChopper(SimObj) != none)
    		UDKVehicleSimChopper(SimObj).bRecentlyHit = false;
    }
    
    // AI hint
    function bool ImportantVehicle()
    {
    	return !bFreelanceStart;
    }
    
    function bool DriverEnter(Pawn P)
    {
    	local UTBot B;
    
    	if ( !Super.DriverEnter(P) )
    		return false;
    
    	B = UTBot(Controller);
    	bFreelanceStart = (B != None && B.Squad != None && UTSquadAI(B.Squad).bFreelance);
    	return true;
    }
    
    function DriverLeft()
    {
    	Super.DriverLeft();
    
    	SetDriving(NumPassengers() > 0);
    }
    
    function PassengerLeave(int SeatIndex)
    {
    	Super.PassengerLeave(SeatIndex);
    
    	SetDriving(NumPassengers() > 0);
    }
    
    function bool PassengerEnter(Pawn P, int SeatIndex)
    {
    	if ( !Super.PassengerEnter(P, SeatIndex) )
    		return false;
    
    	SetDriving(true);
    	return true;
    }
    
    //Switching seats during altfire doesn't replicate because
    //bDriving is the same at the end of the tick as the beginning.  Tell the client
    //to stop firing the weapon it left behind
    simulated function SitDriver( UTPawn UTP, int SeatIndex)
    {
    	if (Role<ROLE_Authority && SeatIndex == 1)
    	{
    		Seats[0].Gun.ForceEndFire();
    	}
    
    	Super.SitDriver(UTP, SeatIndex);
    }
    
    
    /* FIXME:
    function Vehicle FindEntryVehicle(Pawn P)
    {
    	local Bot B, S;
    
    	B = Bot(P.Controller);
    	if ( (B == None) || !IsVehicleEmpty() || (WeaponPawns[0].Driver != None) )
    		return Super.FindEntryVehicle(P);
    
    	for ( S=B.Squad.SquadMembers; S!=None; S=S.NextSquadMember )
    	{
    		if ( (S != B) && (S.RouteGoal == self) && S.InLatentExecution(S.LATENT_MOVETOWARD)
    			&& ((S.MoveTarget == self) || (Pawn(S.MoveTarget) == None)) )
    			return WeaponPawns[0];
    	}
    	return Super.FindEntryVehicle(P);
    }
    */
    
    function bool RecommendLongRangedAttack()
    {
    	return true;
    }
    
    /* FIXME:
    function float RangedAttackTime()
    {
    	local ONSDualACSideGun G;
    
    	G = ONSDualACSideGun(Weapons[0]);
    	if ( G.LoadedShotCount > 0 )
    		return (0.05 + (G.MaxShotCount - G.LoadedShotCount) * G.FireInterval);
    	return 1;
    }
    */
    
    simulated function VehicleWeaponImpactEffects(vector HitLocation, int SeatIndex)
    {
    	local ParticleSystemComponent E;
    
    	Super.VehicleWeaponImpactEffects(HitLocation, SeatIndex);
    
    	if (SeatIndex == 1 && !IsZero(HitLocation))
    	{
    		E = WorldInfo.MyEmitterPool.SpawnEmitter(TurretBeamTemplate, GetEffectLocation(SeatIndex));
    		E.SetVectorParameter('ShockBeamEnd', HitLocation);
    	}
    }
    
    /**
     * We override GetCameraStart for the Belly Turret so that it just uses the Socket Location
     */
    simulated function vector GetCameraStart(int SeatIndex)
    {
    	local vector CamStart;
    
    	if (SeatIndex == 1 && Seats[SeatIndex].CameraTag != '')
    	{
    		if (Mesh.GetSocketWorldLocationAndRotation(Seats[SeatIndex].CameraTag, CamStart) )
    		{
    			return CamStart;
    		}
    	}
    
    	return Super.GetCameraStart(SeatIndex);
    }
    
    /**
     * We override VehicleCalcCamera for the Belly Turret so that it just uses the Socket Location
     */
    simulated function VehicleCalcCamera(float DeltaTime, int SeatIndex, out vector out_CamLoc, out rotator out_CamRot, out vector CamStart, optional bool bPivotOnly)
    {
    	if (SeatIndex == 1)
    	{
    		out_CamLoc = GetCameraStart(SeatIndex);
    		out_CamRot = Seats[SeatIndex].SeatPawn.GetViewRotation();
    	CamStart = out_CamLoc;
    	}
    	else
    	{
    		Super.VehicleCalcCamera(DeltaTime, SeatIndex, out_CamLoc, out_CamRot, CamStart, bPivotOnly);
    	}
    }
    
    simulated function bool ShouldClamp()
    {
    	return false;
    }
    
    defaultproperties
    {
    	Begin Object Class=UDKVehicleSimChopper Name=SimObject
    		MaxThrustForce=700.0
    		MaxReverseForce=700.0
    		LongDamping=0.6
    		MaxStrafeForce=680.0
    		LatDamping=0.7
    		MaxRiseForce=1000.0
    		UpDamping=0.7
    		TurnTorqueFactor=7000.0
    		TurnTorqueMax=10000.0
    		TurnDamping=1.2
    		MaxYawRate=1.8
    		PitchTorqueFactor=450.0
    		PitchTorqueMax=60.0
    		PitchDamping=0.3
    		RollTorqueTurnFactor=700.0
    		RollTorqueStrafeFactor=100.0
    		RollTorqueMax=300.0
    		RollDamping=0.1
    		MaxRandForce=30.0
    		RandForceInterval=0.5
    		StopThreshold=100
    		bShouldCutThrustMaxOnImpact=true
    	End Object
    	SimObj=SimObject
    	Components.Add(SimObject)
    
    	COMOffset=(X=-40,Z=-50.0)
    
    	BaseEyeheight=30
    	Eyeheight=30
    	bRotateCameraUnderVehicle=false
    	CameraLag=0.05
    	LookForwardDist=290.0
    	bLimitCameraZLookingUp=true
    
    	AirSpeed=2000.0
    	GroundSpeed=1600.0
    
    	UprightLiftStrength=30.0
    	UprightTorqueStrength=30.0
    
    	bStayUpright=true
    	StayUprightRollResistAngle=5.0
    	StayUprightPitchResistAngle=5.0
    	StayUprightStiffness=1200
    	StayUprightDamping=20
    DrivingPhysicalMaterial=Physic*alMaterial'VH_Cicada.materials*.physmat_Cicada_driving'
     DefaultPhysicalMaterial=Physic*alMaterial'VH_Cicada.materials*.physmat_Cicada'
    	SpawnRadius=180.0
    	RespawnTime=45.0
    
    	bOverrideAVRiLLocks=true
    
    	PushForce=50000.0
    	HUDExtent=140.0
    
    	HornIndex=0
    }
    Su24_Content.uc
    Code:
    /**
     * Copyright 1998-2012 Epic Games, Inc. All Rights Reserved.
     */
    
    class Su24_Content extends Su24;
    
    var array<UTDecoy> Decoys;
    
    /** Name of the Bone/Socket to base the camera on */
    	var() name CameraTag;
    
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
        local vector SocketLoc;
        local rotator SocketRot;
    
    //get the location and rotation of the socket
        Mesh.GetSocketWorldLocationAndRotation(CameraTag, SocketLoc, SocketRot);
    
            //set the cam location and rotation
    	out_CamLoc = SocketLoc;
    	out_CamRot = SocketRot;
    
    	return true;
    }
    
    defaultproperties
    {
    //change GunViewSocket to whatever your socket is called
    CameraTag=Main_View
    }
    
    
    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_Su24.Mesh.Su24_Assets'
    		AnimTreeTemplate=AnimTree'VH_Su24.Mesh.Su24Factory_AnimTree'
    		PhysicsAsset=PhysicsAsset'VH_Su24.Mesh.Su24_Assets_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',MinDistance=350)
    	BigExplosionTemplates[1]=(Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near')
    
    	Seats.Empty
    
    	VehicleEffects.Empty
    	
    
    	// 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_Collide'
    	EnterVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Start'
    	ExitVehicleSound=SoundCue'A_Vehicle_Cicada.SoundCues.A_Vehicle_Cicada_Stop'
    
    	// 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_Explode'
    	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,DamagePropNames=(Damage1))
    	DamageMorphTargets(3)=(InfluenceBone=MainTurret_Yaw,MorphNodeName=none,Health=150,DamagePropNames=(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_Cicada_driving'
    	DefaultPhysicalMaterial=PhysicalMaterial'VH_Cicada.materials.physmat_Cicada'
    
    	bHasEnemyVehicleSound=true
    	EnemyVehicleSound(0)=SoundNodeWave'A_Character_IGMale.BotStatus.A_BotStatus_IGMale_EnemyCicada'
    }
    Su24Factory.uc
    Code:
    /**
     * Copyright 1998-2012 Epic Games, Inc. All Rights Reserved.
     */
    class Su24Factory extends UTVehicleFactory;
    
    defaultproperties
    {
    	Begin Object Name=SVehicleMesh
    		SkeletalMesh=SkeletalMesh'VH_Su24.Mesh.Su24_Assets'
    		Translation=(X=-40.0,Y=0.0,Z=-70.0) // -60 seems about perfect for exact alignment, -70 for some 'lee way'
    	End Object
    
    	Components.Remove(Sprite)
    
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+120.0
    		CollisionRadius=+200.0
    		Translation=(X=0.0,Y=0.0,Z=-40.0)
    	End Object
    
    	VehicleClassPath="Su24.Su24_Content"
    	DrawScale=1.3
    }
    Thank you very much!

    Leave a comment:


  • replied
    I'm trying to make a helicopter, i've read whole post but i couldn't achieve my goal which is when i stop input, heli should stop like cicada. I don't know how to apply forces relative to yaw either.

    Edit: Never mind i solved it. I just forgot to set my physical material.

    Leave a comment:


  • replied
    The 0 was intented as a placeholder. In contrast to a plane, a spaceship should be able to fly directly upwards and downwards.

    Because there were not enough keys available for mapping the movement on the z-axis to, I neutralied the calculation for the z movement with that 0. Later it would be easy to change the 0 to let's say 4 and multiply it with a variable holding the value of the key press (ranging from -1 to 1).

    E.g.

    AR_ForceApplication = AR_UpwardsNormal * 4 * AR_NewKeyValueForZ + 5 * AR_NewRise * AR_ForwardsNormal;

    Leave a comment:

Working...
X