View Full Version : Polygon velocity inheritance

 baca02 February 2013, 03:13 PMHello. Is there any way to inherit polygon's velocity to the particles when emitting from the surface? Thx.
Srek
02 February 2013, 03:59 PM
You can take the objects velocity and additionaly calculate the distance the point moves due to rotation of the object, however, this will only work for rotations around the object axis. If the object is controlled by Dynamics you can use the angular velocity to get the real value.
In both cases you need to do a bit of vector mathmatics to calculate the difference vector for the point and hence the velocity.

baca
02 February 2013, 10:11 AM
Thanks.
So I need polygon's current and previous position to calculate local movement, also polygon may be streched and etc... Pretty complicated.
There is motion pass in Cinema and I hoped there is built-in possibility. So sad

fuat
02 February 2013, 04:39 PM
what exactly do you want to achieve?
do you mean like subframe emission within TP?
or simple motion inheritance?

fuat

baca
02 February 2013, 09:56 AM
I need to emit particles from moving polygons with speed inheretance. You know if character is moving his arms and legs moves fast and they change direction of movement while body moves constantly and with smooth direction change.
So I want to emit particles from speedy polygons and inherit its speed

littledevil
02 February 2013, 11:30 AM
i would prefer python on this, something like this (just paste it into a python
import c4d
from c4d import utils as u

class CacheStruct():
def __init__(self):
self.Points = []
cache = CacheStruct()

def main():
obj = op.GetObject().GetDeformCache()
if isinstance(obj, c4d.PointObject):
curpoints = obj.GetAllPoints()
if len(cache.Points) > 0 :
for i in xrange(len(curpoints)):
pid = tp.AllocParticle()
tp.SetPosition(pid, curpoints[i])
tp.SetVelocity(pid, (curpoints[i] - cache.Points[i]).GetNormalized() * 100)
cache.Points = curpoints

it is just a rough sketch, it emits particles form an point object vertices and sets
their velocity to the vertex velocity. i used vertices, because i did not want to
bloat the code with polygon handling, there is also missing a meaningful mapping
of the vertex velocity to particle data (min/max speed, min/max pcount, ...)
general idea should be clear. just cache the velocity by yourself.

baca
02 February 2013, 11:57 AM
https://dl.dropbox.com/u/17197754/speed%20weight.c4d
How to force to update polygon selection every time? Material displaying and particles emits from an initial state, while real polygon selection is changed every frame.

baca
02 February 2013, 12:09 PM
Wow Ferdinand, that's really nice. Never used python before
I see just one issue — that's should be rendered frame by frame from first frame? Farm will produce surprizing results :-)

littledevil
02 February 2013, 12:47 PM
as i said there is no mapping/clamping, the code does not clip a speed of zero,this is the
reson for funny first frame and some of the unexpected emissions. it is a fun topic maybe
i'll write an enhanced version when i come home.

douwe
02 February 2013, 02:33 PM
https://dl.dropbox.com/u/17197754/speed%20weight.c4d
How to force to update polygon selection every time? Material displaying and particles emits from an initial state, while real polygon selection is changed every frame.

Not sure why you turned David's VertexMaptoPolySelection Tag into a Node.
You could continuously update the Enable Port of the Tag with an Iteration from 0 to 1.

d

baca
02 February 2013, 03:49 PM
Not sure why you turned David's VertexMaptoPolySelection Tag into a Node.
As I know coffee tag executes just once. Coffee node recalculating every time.

You could continuously update the Enable Port of the Tag with an Iteration from 0 to 1.
Thank you, that's really helped! Nice :-)

CGTalk Moderation
02 February 2013, 03:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1