Scale an Object along Movement Direction

Hey there…
I am trying to make a Trail for a moving ball. At the moment I am spawning objects each frame that indicate a trail for my object. The problem is, if I have a very fast movement I have gaps between the spawned objects. Is there a way to scale my trail objects along my movement direction?

I have tried something like this, but it didn’t work out so good.

trail = scene.addObject(‘ballTrail’, obj,20)
trail.scaling = obj.worldLinearVelocity.normalized()

what I would do is something more like weapon trails.

http://www.unity-news.de/wp-content/uploads/2011/12/weapon-trails.png

You make a plane with several loopcuts along it and basically move each vert to follow your ball. Move the front ones to exactly on the ball each frame, while having the ones behind it copy the loopcut in front of it’s previous position.

yeah… this is something I also thought… but I don’t know exactly how to solve this… ^^

assumes:

  • the trail should scale along X
  • the trail has a scale of (1.0, 1.0, 1.0)
  • the trail has an X-Size of X [the default elements are 2.0!]

scale = trail.localScale
scale.x = obj.worldLinearVelocity.magnitude
trail.localScale = scale

Edit:
With addObject it is not the nicest effect but possible

Attachments

TrailDemo.blend (73 KB)

Thanks alot Monster!!
After Orienting the trail to my ball this method works perfectly!