Forum Thread
Spiral Movement from a center to a rotation (Forums : Cosmos : Spiral Movement from a center to a rotation) Locked
Thread Options
Dec 4 2014 Anchor

Hello. I need to know if anyone can solve this out.
I'm using a particle emitter, each particle get a certain speed to direction of particle emitter rotation. But I need to rotate the particles around the emitter according to their rotation.
I got it.

function Tick (float DeltaTime) {
local vector Dist;
Dist = CallParent.Location-Location //Distance as vector

Velocity.X = Dist.Y*SpiralSpeed;
Velocity.Y -= Dist.X*SpiralSpeed;

The code is in the same particle.
This works but only in the sense Z. I want the mathematical to rotate a particle from the center of his emitter according emitter rotation.

Dec 13 2014 Anchor

Well, both my math and uscript on that are very rusty, but if all you need is that the particle moves around an origin, you probably can do something like:

simulated function Tick(float DeltaTime)
local vector v1, v2, v3;

	v1 = Location - CallParent.Location;
	v2 = Location + Velocity*DeltaTime - CallParent.Location;
	v3 = VSize(v1) * Normal(v2);
	Velocity = SpiralSpeed * Normal(v3 - Location);

I didn't test this (I just wrote it, and I am sleepy as well), so I don't guarantee this will work, but the math idea behind this is:
- v1: a vector from the parent to the particle, to get the distance
- v2: the location that the particle would be 1 tick from now in case it kept the current speed
- v3: the point, in direction to v2, that as a length equal to v1, and this is the point the particle is going to head up in the next tick

Again, not sure if that's going to work as I didn't test it, and it's not a perfect solution (it's just a rather simple one, a proper math solution is a bit harder), but I think for the purpose you intend it should do it. :)

Dec 15 2014 Anchor

Mmmm.. well, i test it but not work. Also i want use the CallParent rotation, i dont know use vector(CallParent.Rotation) or GetAxes. However thank for response. Must exists a way.

Sep 4 2015 Anchor

What game engine or language are you using?

Oct 12 2015 Anchor

That's some hardcore programming. I actually given up on game developing. Decided to just do game management. Share only. lol

May 12 2016 Anchor

If you are just wanting them to rotate in a circular spiral, then use polar to Cartesian coordinate conversions. Basically, the equation theta=radius results in a spiral. Add constants to the equation to shift and stretch outward. You'll then have to convert polar coordinates to Cartesian coordinates....

thats where everything gets messy. I'd suggest googling spirals and converting them to Cartesian coordinates.

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.