Page 1 of 2
Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 09:19
by Skinnytorus
Hey guys!
I'm stuck trying to use a spline for replication of objects by using Loop op. The script does not see the Spline name.
Any ideas how to do that?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 10:00
by ikam
it works fine if you set a name for your spline op.
look at this example. anyway cool way to duplicate object, nice idea to use loop.
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 11:20
by Skinnytorus
Wow! Many thanks, man. An unexpected solution - never thought it could be that way
I will check your example this evening. How did you guess that? Did you look into the code?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 11:33
by ikam
no, surely a divin inspiration powered by megatron... :p
I took the beat loop sample (in example.wz4) as main example to see how they call the beat operator in the loop, it is the same thing here.
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 11:55
by Skinnytorus
I examined that example also, but as far as I remember the name of the beat op was used in the animation script (not the one used for replication). I was thinking of some sort of conversion between the anim script and the replication script... That is why I failed, probably
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 12:25
by ikam
The script does not see the Spline name.
maybe it's because I used yellow op instead mesh ops that won't recognize spline name.
note to optimize render you should use a RenderMesh op (just below your final mesh and before EndLoop) with instance set to on to only call 1 time the mesh render and gain fps. In fact as usual with a yellow multiply.
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 12:35
by Skinnytorus
I see now, that this solution may not be the one I'm looking for. I was thinking of replicating a ballistic particle emitter along the spline statically, loop its delay time i times (the number of shots), and thus create a possibility to fake blaster bolts shot from a flying star ship without deformation of particle trajectory. What do you think of that?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 12:46
by ikam
but why make a thing so complex ?
Why don't you create a spline trajectory for your space ship, and a linear trajectory for your missile, and only trigger the missile animation at the point of the spline when you ship reach it ?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 13:31
by Skinnytorus
Of course, I can match the trajectories by hand, but the idea was to create a dense and rapid blaster fire - not a single rocket.
If the emitter is animated to move along a spline (startpos=spline(time)), then the particles move with the emitter along the spline which is not phisically correct (as far as I remember, I once sent you an example file showing you all that).
Ballistic emitters replicated along the spline with Loop would be a great solution. One emitter = one Shot unaffected by further emitter's movement along the spline. This way we could use as many "shots" as needed. I think it's a nice and simple idea for simulating that kind of stuff, the only problem being the inability to use a spline in the scripting part of the Ballistic op. I was thinking of this code:
startpos=spilne_name(i/i_value);
delay=i/i_value;
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 18:12
by Skinnytorus
Take a look at what I could do with your file. Not quite there, but very close. Any suggestions?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 18:26
by ikam
cool stuff, I think it can produce very interesting animation effects.
did you tried with a fader to resolve the simultaneous start ?
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 18:34
by Skinnytorus
But how? Fader is just a variable and can't replicate an emitter...
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 18:48
by ikam
didn't test, but maybe with multiple ballistic instead of one.
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 21:06
by Skinnytorus
I've taken a closer look and it seems that this setup is working as it should. The problem now is how to make the ship shoot randomly
To tell the truth, I've grown tired of trying to fake a dynamic emitter! I'm sending all my prayers to THE MIGHTY MEGATRON asking him to give you
the strength to implement APEX Particles in wz4!
Re: Replicate object along spline?
Posted:
Tuesday, 20.August 2013, 22:19
by ikam
nice samples
lol, I don't have enough time for now to code the physx particles, but yes it is the next feature i'll add to wz4