GetParticleMotion (Resolved)

Started by GoodMorning, March 16, 2017, 12:14:54 AM

Previous topic - Next topic

GoodMorning

What does this return?
A number of times I have tried to use it for movement angle calculation, but resulting code habitually causes convergence to x=+-y.
So it doesn't seem to return the velocity in X and Y in that order, as the wiki seemed to indicate.

Edit:
It seems it is almost what I thought, save in YX order. That's a lot of avoidable work done. Oh well.
A narrative is a lightly-marked path to another reality.

kajacx

#1
Hm, I wanted to try this but I cant get GETPARTICLESINRANGE to work, and I don't know of any other way to get my hand on a particle ID.

#All particles, square, range, y, x
2 1 10000 50 50 GETPARTICLESINRANGE "does this work?" Trace2


Cas you show some of your code, so I can test this for myslef? (Btw the order both in GetParticlesInRange and GetParticleMotion seems wierd, usually x,y coordinates are sored like that on stack, x and on top of it y. But it's reversed here.)
Why do work yourself, when you can write a program that will do the work for you.

GoodMorning

K75: Certainly, if you think it the correct place.

kajacx: X Y Range Square(else round area) - List(of PIDs)
0 0 10000 1 GetAllParticlesInRange ->Particles
A narrative is a lightly-marked path to another reality.

kajacx

Yea I'm a dumbass and had the arguments in wrong order, accually it is

0 0 10000 1 2 GetParticlesInRange ->Particles

The last argument if for particle over: 0-player, 1-enemy, 2-both
Why do work yourself, when you can write a program that will do the work for you.

GoodMorning

Ah. You will note I supplied the arguments for GetAllParticlesInRange.
A narrative is a lightly-marked path to another reality.

kajacx

Quote from: GoodMorning on March 17, 2017, 08:17:42 PM
Ah. You will note I supplied the arguments for GetAllParticlesInRange.

Hm, that's wierd, I assumed that was a typo since there is no such function on the wiki and my game doesn't recognise it eighter.
Failed compilaton
[close]

What version do you have 1.1.4?
Why do work yourself, when you can write a program that will do the work for you.

GoodMorning

Must be thinking of GAUIR. Forget it, as we're getting topic drift.
A narrative is a lightly-marked path to another reality.

kajacx

#7
Quote from: GoodMorning on March 17, 2017, 08:36:54 PM
Must be thinking of GAUIR. Forget it, as we're getting topic drift.

Yes and yes. I'll delete my posts in abount 15 minutes since they are quite useless not and not on topic and add a acctuall answer to your question instead. EDIT: Oh crap, you can't delete your own posts. Lesson learned for next time I guess. (Sry for spamming your post GM)
Why do work yourself, when you can write a program that will do the work for you.

kajacx

It's hard to see guess |x| is becoming the same as |y| without the code, but it may have something to do with the fact that while GetParticleMotion returns coordinates in order y, x, SetParticleMotion accepts then in order x, y.

This may be so that you can easily feed the coordinates into atan2, which I have done in this quick demo:

0 GetParticlesMotion atan2 ->angle
.05 <-angle add ->angle

0 <-angle cos <-angle sin SetParticleMotion

And it works as intended - the particle is spinning counter-clockwise
Why do work yourself, when you can write a program that will do the work for you.

GoodMorning

#9
Fool that I am, I even read the wiki and left thinking it returned in XY order. I'll edit the original post, although I thought I had tried that solution. On to the wiki, then.

K75, it seems I had placed this thread correctly originally. Would you object to moving it back, that it might be easier to search for those with the same problem?
A narrative is a lightly-marked path to another reality.