First time using DeltaTime, something stopped working tho

Discussions about Coding and Scripting
User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

First time using DeltaTime, something stopped working tho

Post by PrinceOfFunky » Wed Nov 08, 2017 8:21 pm

So, I'm using DeltaTime for the first time, and I like it lol, I understood why certain calculations in Tick() were messing. Now all the calculations work as expected but there's one, which worked before using the DeltaTime(and before I modified the code a bit anyway) that now doesn't work anymore.
Same project of the last two topics I posted:
ParticleSystem_v1b10d1.7z
The class Particle, the bounces works fine when with level geometry, but they don't work at all with actors(while they worked before I changed the code and starting using DeltaTime).
The Physics core is inside Tick() from within the state 'StartPhysics', the bounces on actor are initialized starting from Touch() within the same state of Tick(). There's a function called Hit(), which is called by HitWall() and by Touch(), since Touch() doesn't give the HitNormal, it will build up a dummy HitNormal(vect(0,0,0)), Hit() will see if there is a real or dummy HitNormal and, in case there's no any, will create one basing on the Velocity of the Particle.
The calculation (should) end in TIck(), where HitNormal(saved in a variable called bounceDir) will be used to change the direction of the Particle.
As I said tho, it works with Level Geometry(when the initialization starts from HitWall()), but it doesn't work with Actors(when the initialization starts from Touch()).
The bounces on the Z axis seems to be working fine(at least with particles that have a Velocity only on Z, like without other forces except gravity being applied).
Is it a problem of bad use of DeltaTime?
You do not have the required permissions to view the files attached to this post.
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: First time using DeltaTime, something stopped working th

Post by sektor2111 » Wed Nov 08, 2017 11:47 pm

A question:
It's not good for particle to be a projectile without damage and using ProcessTouch ?

I guess there is doable some "back to home" thing when ProcessTouch is getting called + see what does it happen if they fall in void... we might have "cute" maps with such options...

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: First time using DeltaTime, something stopped working th

Post by PrinceOfFunky » Thu Nov 09, 2017 2:24 am

sektor2111 wrote:A question:
It's not good for particle to be a projectile without damage and using ProcessTouch ?

I guess there is doable some "back to home" thing when ProcessTouch is getting called + see what does it happen if they fall in void... we might have "cute" maps with such options...
Well I converted Particle into a Projectile, sadly ProcessTouch() only gives the HitLocation, not the HitNormal, well at least there's something more now, so ty.
The problem is that the calculations inside Tick() seem to be calculated more than once before a screen update.
This is how I changed the class (The friction change which has nothing to do with this topic):

Code: Select all

/*
 * Supposed to be done by a community
 */

class Particle extends Projectile;
 
var ParticleSystem particleSys;

var vector friction;

var vector fixedForce;
var vector bounceDir;
var Actor lastHitActor; //Used for bounces.
var vector ParticleHitNormal;
var Actor ParticleHitWall;
var int bounceCounter;
var bool bHitEffect;

auto state Init {
	event BeginState() {
		bCollideWorld = true;
		particleSys = ParticleSystem(owner);
		if (particleSys == None)
			destroy();
		
		if (particleSys.localPlayer == None)
			particleSys.FindLocalPlayer();
		if (particleSys.localPlayer == None)
			destroy();
			
		GotoState('Resetting');
	}
}

event FellOutOfWorld() {
	GotoState('Resetting');
}

event Timer() {
	GotoState('Resetting');
}

state Resetting
{
	event BeginState() {
		bHidden = true;
		Setup();
	}

	function Setup() {
		local vector relativeLoc;
		local int i;

		for (i = 0; i < particleSys.MaxSetLocationAttempts; ++i) {
			relativeLoc = particleSys.Location + particleSys.RandRangeVec(particleSys.minSpawnLoc, particleSys.maxSpawnLoc);

			if (SetLocation(relativeLoc))
				if (particleSys.allowNewLoc(self))
					if (!particleSys.bEmitInZone || (particleSys.bEmitInZone && (Region.Zone == particleSys.Region.Zone)))
						if ((particleSys.maxDistFromPlayer == 0) || (VSize(Location - particleSys.localPlayer.Location) <= particleSys.maxDistFromPlayer))
							if (!particleSys.bSpawnInViewport || (particleSys.bSpawnInViewport && (PlayerCanSeeMe())))
								break;
		}
		bHidden = i == particleSys.MaxSetLocationAttempts;
		
		if (bHidden) {
			GotoState('Resetting'); 
		} else {
			//Actual reset.
			fixedForce = particleSys.RandRangeVec(particleSys.minFixedForce, particleSys.maxFixedForce);
			SetCollision(particleSys.bBlockByActors, false, false);
			bounceCounter = 0;
			Velocity *= 0;
			Mass = particleSys.particlesMass;
			Texture = particleSys.particlesTexture;
			setTimer(particleSys.forcedResetInterval, false);
			
			GotoState('StartPhysics');
		}
	}
}

function ApplyForce(vector force) {
	Acceleration += (force / Mass);
}

//Actually not rly all, the bounce forces are applied later.
function ApplyAllForces() {
	local ForceInfo forceInfo;
	local float distFromForce;
	local vector actualForce;
	
	ApplyForce(friction);
	ApplyForce(Region.Zone.ZoneGravity * Mass);
	ApplyForce(Region.Zone.ZoneVelocity);
	ApplyForce(fixedForce);
	foreach AllActors(class'ForceInfo', forceInfo) {
		actualForce = forceInfo.force;
		if (VSize(forceInfo.actionDist) != 0) {
			distFromForce = VSize(Location - forceInfo.Location);
			if (distFromForce < 0)
				distFromForce *= -1;
			if (distFromForce > (FMax(FMax(forceInfo.actionDist.X, forceInfo.actionDist.Y), forceInfo.actionDist.Z)))
				continue;
				
			actualForce.X = map(distFromForce, 0, forceInfo.actionDist.X, forceInfo.force.X, 0);
			actualForce.Y = map(distFromForce, 0, forceInfo.actionDist.Y, forceInfo.force.Y, 0);
			actualForce.Z = map(distFromForce, 0, forceInfo.actionDist.Z, forceInfo.force.Z, 0);
		}
		
		ApplyForce(actualForce - forceInfo.Location);
	}
}

static function limitVelocity(Actor runner, vector limit) {
	//Limit positive velocity.
	if (runner.Velocity.X > limit.X)
		runner.Velocity.X = limit.X;
	if (runner.Velocity.Y > limit.Y)
		runner.Velocity.Y = limit.Y;
	if (runner.Velocity.Z > limit.Z)
		runner.Velocity.Z = limit.Z;
	//Limit negative velocity.
	if (runner.Velocity.X < (limit.X * -1))
		runner.Velocity.X = limit.X * -1;
	if (runner.Velocity.Y < (limit.Y * -1))
		runner.Velocity.Y = limit.Y * -1;
	if (runner.Velocity.Z < (limit.Z * -1))
		runner.Velocity.Z = limit.Z * -1;
}

static function vector calcHitNormalApprox(Actor act) {
	local float max;
	local vector positiveVel, hitNormal;
	
	if (act.Velocity.X < 0)
		positiveVel.X = (act.Velocity.X * -1);
	if (act.Velocity.Y < 0)
		positiveVel.Y = (act.Velocity.Y * -1);
	if (act.Velocity.Z < 0)
		positiveVel.Z = (act.Velocity.Z * -1);
		
	max = FMax(FMax(positiveVel.X, positiveVel.Y), positiveVel.Z);
	if (positiveVel.X == max)
		hitNormal.X = 1;
	else if (positiveVel.Y == max)
		hitNormal.Y = 1;
	else if (positiveVel.Z == max)
		hitNormal.Z = 1;
		
	return hitNormal;
}

function float map(float x, float inMin, float inMax, float outMin, float outMax) {
	return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}

function Hit(actor HitStuff, vector HitNormal) {
	local HitEffect hitFX;
	
	if ((HitStuff != None) && (VSize(HitNormal) == 0))
		HitNormal = calcHitNormalApprox(self);
	
	if ((particleSys.maxBounces <= 0) || ((particleSys.maxBounces > 0) && (bounceCounter >= particleSys.maxBounces))) {
		ParticleHitNormal = HitNormal;
		ParticleHitWall = HitStuff;
		if (bHitEffect) {
			hitFX = spawn(particleSys.hitEffectClass,,,Location);
			if (hitFX != None)
				hitFX.init(ParticleHitNormal, ParticleHitWall);
		}
		
		if (!particleSys.bResetOnLastHit)
			GotoState('Idle');
		else
			GotoState('Resetting');
	} else {
		//FIXME - Only check for the last hti actor, shouldn't it be applied for any actor who's currently touching(maybe implementing it inside ApplyAllForces)?
		bounceDir = HitNormal;
		lastHitActor = HitStuff;
		bounceCounter++;
	}
}

event HitWall(vector HitNormal, actor HitWall) {
	Hit(HitWall, HitNormal);
}

static function vector normalNoRound(vector vec) {
	local float normCohefficent;
	local vector normVec;
	
	normCohefficent = (vec.x * vec.x) + (vec.y * vec.y) + (vec.z * vec.z);
	normVec = vec / normCohefficent;
}

state Idle {
Ignores HitWall;
}

static function float getMagnitude(vector vec) {
	return sqrt(vec.X^2 + vec.Y^2 + vec.Z^2);
}

state StartPhysics {
	event BeginState() {
		SetPhysics(PHYS_Projectile);
	}

	event EndState() {
		//The particle will move back to the initial position, it needs to be non-collidable.
		SetCollision(false);
		SetPhysics(PHYS_None);
	}

	function ProcessTouch(Actor Other, Vector HitLocation) {
		Hit(Other, vect(0,0,0));
	}

	event ZoneChange(ZoneInfo NewZone) {
		particleSys.particleZoneChange(self, NewZone);
	}

	event Tick(float DeltaTime) {
		local vector otherForce;
	
		friction = (Velocity * -1);
		friction = normalNoRound(friction);
		if (!Region.Zone.bWaterZone)
			friction *= Region.Zone.ZoneGroundFriction;
		else
			friction *= Region.Zone.ZoneFluidFriction;
		
		ApplyAllForces();
		
		//Calculate bounce velocity.
		if (VSize(bounceDir) != 0) {
			if (bounceDir.X != 0)
				Velocity.X *= -1;
			else if (bounceDir.Y != 0)
				Velocity.Y *= -1;
			else if (bounceDir.Z != 0)
				Velocity.Z *= -1;
				
			bounceDir *= 0;
		}
		
		if ((lastHitActor != None) && !lastHitActor.IsA('LevelInfo')) {
			otherForce.X = lastHitActor.Velocity.X + DeltaTime;
			otherForce.Y = lastHitActor.Velocity.Y + DeltaTime;
			otherForce.Z = lastHitActor.Velocity.Z + DeltaTime;
			ApplyForce(otherForce);
			particleSys.localPlayer.PlayerReplicationInfo.PlayerName = (Level.TimeSeconds@Acceleration);
		}
		Log(Level.TimeSeconds@Acceleration);
		
		lastHitActor = None;
		
		Velocity += Acceleration * DeltaTime;
		
		//Limiting the Velocity to the Zone Terminal Velocity.
		limitVelocity(self, vect(1,1,1) * Region.Zone.ZoneTerminalVelocity);
		
		// Reset acceleration
		Acceleration *= 0;
	}
}

event Destroyed() {
	if (particleSys != None) {
		particleSys.particlesCounter--;
		particleSys.enable('timer');
	}
}

defaultproperties
{
   RemoteRole=ROLE_None
   DrawType=DT_Sprite
   Style=STY_Translucent
   DrawScale=0.2
   Mass=1
   bBounce=True
   CollisionRadius=1
   CollisionHeight=1
   bNetTemporary=False
   bReplicateInstigator=False
   LifeSpan=0
   bDirectional=False
}
Note how in Tick() there's this piece of code:

Code: Select all

if ((lastHitActor != None) && !lastHitActor.IsA('LevelInfo')) {
			otherForce.X = lastHitActor.Velocity.X + DeltaTime;
			otherForce.Y = lastHitActor.Velocity.Y + DeltaTime;
			otherForce.Z = lastHitActor.Velocity.Z + DeltaTime;
			ApplyForce(otherForce);
			particleSys.localPlayer.PlayerReplicationInfo.PlayerName = (Level.TimeSeconds@Acceleration);
		}
		Log(Level.TimeSeconds@Acceleration);
		
		lastHitActor = None;
		
		Velocity += Acceleration * DeltaTime;
There's a log right after ApplyForce(otherForce). That log shows the acceleration right after the velocity of the touching player has been applied to the particle, and in which Level.TimeSeconds the calculation was done.
The second log is right after, does the same but the previous "if" body could haven't been called, since it is called only when lastHitActor != None.
Right after the logs lastHitActor is set to None and the Acceleration is applied to the velocity.
I tried touching a falling on its Z axis Particle, while moving forward with the player, and this is the PlayerName log:

Code: Select all

2.981958 132.402542,15.717022,-50.481331
While I get 3 logs of the second log in, apparently, the same Level.TimeSeconds:

Code: Select all

ScriptLog: 2.981958 0.031926,-0.098551,-1000.660767
ScriptLog: 2.981958 132.402542,15.717022,-50.481331
ScriptLog: 2.981958 0.000000,0.000000,-1021.774353
I don't get it, is it like Velocity gets resetted? Cause of course the first time it bounces lastHitActor will exist but it will be set to None in Tick(), so if Tick() is called more than once before the screen update, it won't find the lastHitActor the other times.

Anyway, I changed Tick() like this:

Code: Select all

	event Tick(float DeltaTime) {
		local vector otherForce;
	
		friction = (Velocity * -1);
		friction = normalNoRound(friction);
		if (!Region.Zone.bWaterZone)
			friction *= Region.Zone.ZoneGroundFriction;
		else
			friction *= Region.Zone.ZoneFluidFriction;
		
		ApplyAllForces();
		
		//Calculate bounce velocity.
		if (VSize(bounceDir) != 0) {
			if (bounceDir.X != 0)
				Velocity.X *= -1;
			else if (bounceDir.Y != 0)
				Velocity.Y *= -1;
			else if (bounceDir.Z != 0)
				Velocity.Z *= -1;
				
			bounceDir *= 0;
		}
		
		Velocity += Acceleration * DeltaTime;
		
		// Reset acceleration
		Acceleration *= 0;
		
		if ((lastHitActor != None) && !lastHitActor.IsA('LevelInfo')) {
			otherForce.X = lastHitActor.Velocity.X + DeltaTime;
			otherForce.Y = lastHitActor.Velocity.Y + DeltaTime;
			otherForce.Z = lastHitActor.Velocity.Z + DeltaTime;
			ApplyForce(otherForce);
			Velocity += Acceleration;
			// Reset acceleration
			Acceleration *= 0;
		}
		
		lastHitActor = None;
		
		//Limiting the Velocity to the Zone Terminal Velocity.
		limitVelocity(self, vect(1,1,1) * Region.Zone.ZoneTerminalVelocity);
	}
}
The bounce now works correctly. Wanna know why? Well, me too.


EDIT: I just understood DeltaTime /o\

Ok I "fixed" the Tick() with a better(I hope) implementation of DeltaTime, but now the bounces on player have the same issue of before lol.
This is the modified Tick():

Code: Select all

	event Tick(float DeltaTime) {
		friction = (Velocity * -1);
		friction = normalNoRound(friction);
		if (!Region.Zone.bWaterZone)
			friction *= Region.Zone.ZoneGroundFriction;
		else
			friction *= Region.Zone.ZoneFluidFriction;
		friction *= DeltaTime;
		
		ApplyAllForces();
		
		//Calculate bounce velocity.
		if (VSize(bounceDir) != 0) {
			if (bounceDir.X != 0)
				Velocity.X *= -1;
			else if (bounceDir.Y != 0)
				Velocity.Y *= -1;
			else if (bounceDir.Z != 0)
				Velocity.Z *= -1;
				
			bounceDir *= 0;
		}
		
		if ((lastHitActor != None) && !lastHitActor.IsA('LevelInfo'))
			ApplyForce(lastHitActor.Velocity);

		lastHitActor = None;
		
		Velocity += Acceleration * DeltaTime;
		//Limiting the Velocity to the Zone Terminal Velocity.
		limitVelocity(self, vect(1,1,1) * Region.Zone.ZoneTerminalVelocity);
		
		//Reset acceleration
		Acceleration *= 0;
	}
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
Barbie
Godlike
Posts: 2107
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: First time using DeltaTime, something stopped working th

Post by Barbie » Thu Nov 09, 2017 5:40 am

Just throwing into the function MirrorVectorByNormal - hope it helps. I've lost the overview what is working in your code and what not.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: First time using DeltaTime, something stopped working th

Post by sektor2111 » Thu Nov 09, 2017 6:59 am

I think this subject is way too complex. Let me see, a rocket fired from an upper spot to the ground can be "the particle". Why do we need so much "Tick Science" for making it to return at home when ZoneChange get's called and/or ProcessTouch ? You will not use Destroy() it will be replaced with SendToOrigin() computed in some random area else create new one if area is rammed. I really don't get useless maths for each particle. Seriously another time I'll do such sort of thing and using more rocket code, to not forget "function/event Landed" specific to some biogel which simply fall "attaching to surface" but these can be different. By only thinking at these solutions I'm not even bother to track long ticks codes, vectors and all that.

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: First time using DeltaTime, something stopped working th

Post by PrinceOfFunky » Thu Nov 09, 2017 9:05 pm

Barbie wrote:Just throwing into the function MirrorVectorByNormal - hope it helps. I've lost the overview what is working in your code and what not.
Great! I didn't know about that function, thank you. I wonder where Epic used it in.
It's easier to understand what isn't working in my code if you can look it, you can try it with an example map:
ParticleSystem_v1b11.7z
DM-ParticleSystem_v1b11_TEST.unr
If you try pushing the particle in the middle of the map for example, it won't be pushed, it can only bounce on your head.
ApplyAllForces() is called every tick, there's this part of code inside:

Code: Select all

if ((lastHitActor != None) && !lastHitActor.IsA('LevelInfo'))
		ApplyForce(lastHitActor.Velocity);
		
	lastHitActor = None;
It works, the force is applied to the Acceleration, but it looks like Tick() is called more than once in the same Level.TimeSeconds, which means lastHitActor will always be None except for the first tick in the same Level.TimeSeconds.
sektor2111 wrote:I think this subject is way too complex. Let me see, a rocket fired from an upper spot to the ground can be "the particle". Why do we need so much "Tick Science" for making it to return at home when ZoneChange get's called and/or ProcessTouch ? You will not use Destroy() it will be replaced with SendToOrigin() computed in some random area else create new one if area is rammed.
Well, the code is a modification of this one:
https://www.ut99.org/viewtopic.php?t=12440
The recycling of "particles" is done to use less CPU, since destruction and respawning uses more of it.
Also, the particles I'm making don't just fall, settings could change every time and new physical forces could be added in the map.
You do not have the required permissions to view the files attached to this post.
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: First time using DeltaTime, something stopped working th

Post by sektor2111 » Thu Nov 09, 2017 10:34 pm

You did not read what I was posting... I said REPLACE DESTROY WITH A SETLOCATION.

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: First time using DeltaTime, something stopped working th

Post by PrinceOfFunky » Thu Nov 09, 2017 11:09 pm

sektor2111 wrote:You did not read what I was posting... I said REPLACE DESTROY WITH A SETLOCATION.
Destroyed() brings to the state 'Resetting' there's already a SetLocation there, the settings in 'Resetting' are based on variables which could potentially change in real time if bDynamicSettings is set to true(in PartycleSystem), what I can do if I would rly need to do everything inside Destroyed() instead than calling GotoState('Resetting') would be to bring all the code from Setup() into Destroyed(), but why should I do it?
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
Barbie
Godlike
Posts: 2107
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: First time using DeltaTime, something stopped working th

Post by Barbie » Fri Nov 10, 2017 4:01 am

PrinceOfFunky wrote:I wonder where Epic used it [MirrorVectorByNormal()] in.
It does not occur in (my copy) of the UC stock files, but it can be used to calculate a reflection on a plane (where the normal vector stands on).

I used it in a modified (and still unreleased) version of MH-Shrak3, where razor blades are flying around and bounced at walls:

Code: Select all

simulated function HitWall(vector HitNormal, actor Wall) {
...
	Velocity = MirrorVectorByNormal(Velocity, HitNormal);
In Particle.StartPhysics.Tick your are using

Code: Select all

Velocity += Acceleration * DeltaTime;
Isn't the velocity calculated and applied by the engine itself (by the values of Velocity and Aceleration)?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: First time using DeltaTime, something stopped working th

Post by sektor2111 » Fri Nov 10, 2017 7:14 am

Okay I go to setup sample quote because I see you in a complete fog, I did not speak about any usage of destroyed, keep that for its own purpose.
Some original rocket

Code: Select all

	simulated function ProcessTouch (Actor Other, Vector HitLocation)
	{
		if ((Other != instigator) && (Rocket(Other) == none)) 
			Explode(HitLocation,Normal(HitLocation-Other.Location));
	}
...
	simulated function Explode(vector HitLocation, vector HitNormal)
	{
		local SpriteBallExplosion s;
		local RingExplosion3 r;

		s = spawn(class'SpriteBallExplosion',,,HitLocation + HitNormal*16);	
 		s.RemoteRole = ROLE_None;

		if (bRing) 
		{
			r = Spawn(class'RingExplosion3',,,HitLocation + HitNormal*16,rotator(HitNormal));
			r.RemoteRole = ROLE_None;
		}
		BlowUp(HitLocation, r);

 		Destroy();
	}
Now all needs is replacing RingExplosion removing anything from processtouch and simply calling explosion, and using some splash type (exist such splash in UT), "blowup" removed (damage not needed) and replaced destroy with...

Code: Select all

//Destroy();
bHidden=True;
SetLocation(GeneratorLocation + SomeRandomRange.location);
bHidden=False;
Why is that hard to work simple ? Never mind if you want to make your life harder, on future I might setup such a PrecipitationGenerator with particles RECYCLING without useless vectors and ticks blabbering. Codes are half written so I will not need to reinvent the warm water.
I never said anything about "Destroyed()", else state code is probably too slow for this task - states are not changing when we want, engine changes them when it wants, you should not change state and just change LABEL in the same state and loop inside it. Destroyed has no logic for me in a RECYCLING system, if you want to reuse it why should you make a bad deal ? Destroyed is the last word of an actor before to go as garbage. Why to mock with that ?
Else things are mapped simple, if generator is properly mapped in down direction with "face to the ground". Spawning projectiles will have an original rotation to the ground and... nothing is needed later that counting particles from time to time or control their number based on Biterfish BitterFishSchool relations in case that particle is lost and we need another new one created for keeping their number as in config. Once touched the ground is automated to home location + random spot on X, Y. Did you get what I mean ? I have doubts...

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: First time using DeltaTime, something stopped working th

Post by PrinceOfFunky » Fri Nov 10, 2017 7:59 pm

Barbie wrote:In Particle.StartPhysics.Tick your are using

Code: Select all

Velocity += Acceleration * DeltaTime;
Isn't the velocity calculated and applied by the engine itself (by the values of Velocity and Aceleration)?
Looks like it doesn't happen with certain Physics types, like PHYS_Projectile.
sektor2111 wrote:Spawning projectiles will have an original rotation to the ground and... nothing is needed later that counting particles from time to time or control their number based on Biterfish BitterFishSchool relations in case that particle is lost and we need another new one created for keeping their number as in config. Once touched the ground is automated to home location + random spot on X, Y. Did you get what I mean ? I have doubts...
Maybe you didn't notice the ForceInfo calss, you're most likely talking about this one class, if I wanted the particle to just fall down then I wouldn't have modified it, I want it to respect realistic physics, not just a scripted falling down. It doesn't have to go "home" after touching the ground, it has to bounce if maxBounces>0.
About states, the problem isn't that I go from state to state, the problem is that the particles don't bounce on actors on the X and Y axis, just on the Z, I'm trying to solve that, if going from state to state is a problem that's secondary I guess.
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: First time using DeltaTime, something stopped working th

Post by sektor2111 » Sat Nov 11, 2017 8:10 am

PrinceOfFunky wrote:I want it to respect realistic physics, not just a scripted falling down.
I didn't even mention any ScriptedPawn, ScriptedPawn doesn't explode. :omfg: Ahah... you have a ScriptedPawn problem as others have with Bots, then keep drawing walls if that's the ONLY goal.
PrinceOfFunky wrote: don't bounce on actors on the X and Y axis, just on the Z, I'm trying to solve that
Else Which Grenade is not bouncing ? How about "bump" ? These codes are done for years, and they need a bit of changes and nothing like a rocket science.
At "ProcessTouch" from PROJECTILE ROCKET ANY "BOUNCE", "Jump", "Sound", "Splash", etc, is doable or whatever stunt, but you are thinking in a way too limited...
Now you proved that you did not even understand what I'm saying, If I'll be in a good disposition I will just release something without to start 5 pages with useless debates about not needed ticks and all that spam engine code, just for fun. I'm curious how goes such a tick when we speak about 200 particles bouncing and when iterations limit will bite your raining spree.