Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/27/26 22:06
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 5,782 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make smooth trail? #214565
07/05/08 12:32
07/05/08 12:32
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
I'm trying to create trail effect for my Ball. Placing a new particle per frame each time my ball move makes the gap between trails particle too far due to very fast c_move.

So my idea is, each time c_move is called, get the lastPos and currentPos of the ball, and placing several particle between the gap.

But my code not working perfectly. Please advise. Or maybe if you have a workable function, please let me know.


function BeamAnimate()
{
vec_set(BallLastPos, BallCurrentPos);
vec_set(BallCurrentPos, Ball.x);

VECTOR beamDiff;
vec_diff(beamDiff,BallCurrentPos,BallLastPos);

var temp0;
var beamNum = integer ( vec_dist(BallLastPos,BallCurrentPos) / 0.1 );
for (temp0=0; temp0<beamNum; temp0++)
{
VECTOR beamIncrement;
vec_set (beamIncrement,beamDiff);
vec_scale(beamIncrement,0.1*temp0);
vec_add (BallLastPos,beamIncrement);
effect(ParticleEffectBeam,1,BallLastPos,nullvector);
}
}



function BallMove()
{
while (1)
{
c_move(Ball, vector(100*time_step,0,0), nullvector, GLIDE | IGNORE_PASSABLE);
BeamAnimate();
wait(1);
}
}



One more thing, is there any online tools that can convert my coding into proper UBBCode so that my coding is properly align?

Re: How to make smooth trail? [Re: Coisox] #214695
07/06/08 14:40
07/06/08 14:40
Joined: Jun 2008
Posts: 91
C
Coisox Offline OP
Junior Member
Coisox  Offline OP
Junior Member
C

Joined: Jun 2008
Posts: 91
I found the solution. Not accurate but so so.

Code:
function BeamAnimate()
{
	vec_set(BallLastPos, BallCurrentPos);
	vec_set(BallCurrentPos, Ball.x);
	
	VECTOR BallHeading;
	vec_diff(BallHeading,BallCurrentPos,BallLastPos);
	vec_scale(BallHeading,0.1);

	var temp0;
	for (temp0=0; temp0<10; temp0++)
	{
		vec_add(BallLastPos,BallHeading);
		effect(ParticleEffectBeam,1,BallLastPos,nullvector);
	}
}

function BallMove()
{
	while (1)
	{
		c_move(Ball, vector(100*time_step,0,0), nullvector, GLIDE);
		BeamAnimate();
		wait(1);
	}
}



Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1