Browse Search Popular Register Upload Rules User list Login:

screenshot of the scene

Author: Xray

Group: Default

Filesize: 21.02 kB

Date added: 2013-10-16

Rating: 5

Downloads: 489

Views: 223

Comments: 9

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0


Scene tag

I found a function which makes cloning a tracer very simple. It is "sceneCloneEntityTo". You need only the tracer's entityID and pos. I was able to duplicate your scenes with a lot less code. Let me know what you think about it.

Rev. A - Fixed spawned position discrepancy. Now calculates new position based on tracer relpoint (algorithm designed by s_noonan).

Rev. B - Fixed a problem that s_noonan describes in his comments.
Last edited at 2013/10/18 15:41:21 by Xray
Please log in to rate this scene
Similar scenes
Title: Clear Tracer Response
Rating: 5
Filesize: 20.88 kB
Downloads: 269
Comments: 6
Ratings: 1
Date added: 2013/10/11 00:14:21
Made with: Algodoo v2.1.0
Rating: rated 5
Title: BFTCC REMINDER 2 (sorry for uploading so many times.)
Rating: 5
Filesize: 0.54 MB
Downloads: 95
Comments: 2
Ratings: 1
Date added: 2017/12/15 10:47:27
Made with: Algodoo v2.1.0
Rating: rated 5
Title: Response for TWOWgodoo
Rating: 5
Filesize: 53.7 kB
Downloads: 50
Comments: 1
Ratings: 1
Date added: 2016/08/09 23:41:22
Made with: Algodoo v2.1.0
Rating: rated 5
Title: artificial tracer/track effect.
Rating: 5
Filesize: 8.47 kB
Downloads: 259
Comments: 3
Ratings: 1
Date added: 2013/06/13 07:34:00
Made with: Algodoo before v1.8.5
Rating: rated 5
Title: Radial 4-cyl Collision Engine
Rating: 5.6667
Filesize: 0.67 MB
Downloads: 342
Comments: 3
Ratings: 3
Date added: 2011/04/02 20:38:54
Made with: Algodoo before v1.8.5
Rating: rated 5.7
Title: What e rEsponse
Rating: 5
Filesize: 25.08 kB
Downloads: 179
Comments: 0
Ratings: 1
Date added: 2014/06/09 10:09:23
Made with: Algodoo v2.1.0
Rating: rated 5
This scene is a response to:
Title Author Rating Downloads Comments Date added
Clear Tracer Response s_noonan 5 (1 vote) 269 6 2013/10/11 00:14:21
show grid
Close, but you are not quite there yet. The tracer moves a little bit each time you clear the trail. Put the tracer on the circle cake and then clear the trail and you will see what I mean.
Holy cow! You're right! When I increase the rotational speed, the spawned tracers are about 45 degrees off from the previous one! Back to the drawing board. )|(

Thanks for catching this glitch for me. Quite often, an engineer doesn't see his/her own mistakes, and they need another set of eyes.

EDIT - I now use your calculation of the pos based on the tracer relPoint. That seems to be more accurate than spawning a new tracer using just its pos. I believe I know why that happened, but because I am so verbose, my explanation would require about four pages of text, and therefore I decided not to explain it! :lol:
Last edited at 2013/10/17 03:49:45 by Xray
You might be there, but I see a potential problem. You create the new tracer before deleting the old and both tracers have the clearTracer code in them. Algodoo deletes the old tracer first, but is this guaranteed to happen all the time? Also, if the circle's code is run in two consecutive sim periods, then the tracer is lost forever. If you move the circle's code from postStep to onHitByLaser, then you might see what I mean. Another way to see it is to set the sim speed to 0.01 and click "Clear Trail" repeatedly. This is not a problem for this particular scene, but it may cause problems when this concept is applied elsewhere.
Thanks for your critique of this scene. I appreciate it very much.

Because I use the "sceneCloneEntityTo" function, the old tracer cannot be deleted before the new one gets cloned (unlike your scheme where you spawn a completely new tracer with data that was collected from the old one).

I was not able to duplicate your findings by setting the sim speed at 0.01. I even tried setting the sim frequency to a very low value. The scene still worked flawlessly. I'm going to leave it as-is. Anyone who uses it in their own scenes will just have to remember that it was created by another user, and they will get what they paid for!

Be my guest if you would like to improve it or embellish it.
If you replace = true



then the problem (that you don't see but is really there) will go away.

P.S. An easy way to check it before and after the change is to place " = true" in the onHitByLaser event of the circle and then add a laser to the scene that is activated by a keypress.
Last edited at 2013/10/17 23:17:35 by s_noonan
Well, I tried your "fix" and it doesn't work. A new tracer gets cloned but the old one doesn't get deleted. Here is the new code in the circle: ? { = false;
_tracerPos := pos + _tracerRelPoint(0) * [math.cos(angle), math.sin(angle)] + _tracerRelPoint(1) * [-1.0 * math.sin(angle), math.cos(angle)];
Scene.cloneEntityTo(Scene.entityByID(_tracerEntity­ID), _tracerPos);
} : {}
and here is the code in the tracer:
g0 = entityByGeomID((readable(owner)).geom);
g0._tracerRelPoint = (readable(owner)).relPoint;
g0._tracerEntityID = entityID

What went wrong?

EDIT: I moved the geometry code from "postStep" to "update" and now it seems to work correctly.
Last edited at 2013/10/18 05:09:40 by Xray
Q: What went wrong?
A: I'm not sure. The code you stated above works OK for me when in the postStep event. The only thing I can think of is that when the removeEntity line of code is copied from the web page to postStep it does not copy correctly. If I copy the removeEntity line of code from the web page to Notepad, I can see that an additional character shows up.

P.S. I tried the laser test mentioned above on your scene and Algodoo crashes. Algodoo does not crash if the code is in the postStep event.
Last edited at 2013/10/18 10:02:08 by s_noonan
This scene is making me crazy. :bonk: :blink: I moved the code back to postStep, and now it works just fine. I don't know what happened before, but it would not work, and that's when I tried moving it to update, which worked. But because you found that it crashes under certain conditions, I certainly don't want to leave it that way.

Thanks for all your help, Master Po. _o_

Last edited at 2013/10/18 15:48:09 by Xray
Yes. Works well. I tried a variation that is interesting, but is not as easy to implement as yours.

In Circle postStep: ? { = false;
myTracer := (readable(;
tracerPos := pos + myTracer.relPoint(0) * [math.cos(angle), math.sin(angle)] + myTracer.relPoint(1) * [-1.0 * math.sin(angle), math.cos(angle)];
tracerID :=;
cloneEntityTo(entityByID(tracerID), tracerPos);
} : {}

in tracer onSpawn: = entity

The only problem with this is that has to be initially set to the present tracer in order for the scene to start working. This can be done by saving and reopening the scene.

Your scene is better than this because it doesn't require an explanation.