transform world-vector bug (breve 2.4 beta)
Calling Link's superclass method (transform world-vector) always returns null.
I'm trying to implement a "motion trail" for moving objects, so I implemented this class, which for many purposes is OK:
Link : LinkWithTrail
{
+ variables:
trail (object).
+ to init:
trail = new Drawing.
trail set-instruction-limit to 100.
+ to iterate:
trail add-line-point at (self get-location).
}
The problem is, the (self get-location) method gives me the center of the link, but in some cases I need to draw the trail near one of the ends of the object, so I tried this:
Link : LinkWithTrail
{
+ variables:
trail (object).
+ to init:
trail = new Drawing.
trail set-instruction-limit to 100.
+ to iterate:
trail add-line-point at (self transform world-vector (0.0, 2.0, 0.0)).
}
But I get the following error:
Quote:cannot convert type "(null)" to type "vector"
Error evaluating keyword "at" for method "add-line-point"
Also, I made a simple test breve script to make testing easier, based on the JointTypeExample.tz (under the Demos>Programming-Examples menu), but found out that both the example and my test script produce a continuous stream of "unknown atomic type 0 in slFormatEvaluation" messages in the log window.
Nonetheless, that last error is not present on the project in which I intend to use the (self transform world-vector ...) method, yet the "cannot convert type "(null)" to type "vector"" still appears, so it seems to be a separate and unrelated bug.
Here is the script so you can test it:
@include "PhysicalControl.tz"
@include "Joint.tz"
@include "MultiBody.tz"
@include "Link.tz"
@include "Shape.tz"
@include "Stationary.tz"
@include "Drawing.tz"
Controller JointTest.
PhysicalControl : JointTest
{
+ variables:
body (object).
+ to init:
new Stationary register with-shape (new Cube init-with size (100, 0.1, 100)) at-location (0, 0, 0).
body = new JointTestBody.
self point-camera at (0, 10, 0) from (10, 2, 10).
self watch item body.
}
Link : LinkWithTrail
{
+ variables:
trail (object).
+ to init:
trail = new Drawing.
trail set-instruction-limit to 100.
+ to iterate:
# This works, but only if I want the trail to be at the center of the Link object:
trail add-line-point at (self get-location).
# If instead I use this and comment the previous line, it fails:
#trail add-line-point at (self transform world-vector (0.0, 2.0, 0.0)).
}
MultiBody : JointTestBody
{
+ variables:
shape, smallShape, joint, worldJoint (object).
links (list).
+ to init:
shape = (new Cube init-with size (0.5, 2.0, 0.5)).
smallShape = (new Cube init-with size (0.4, 2.0, 0.4)).
links{0} = new Link.
links{1} = new LinkWithTrail.
links{0} set-shape to shape.
links{1} set-shape to smallShape.
self set-root to links{0}.
worldJoint = new FixedJoint.
worldJoint link parent 0 to-child links{0}
with-parent-point (0, 10, 0) with-child-point (0, -1.0, 0).
joint = new ExampleUniversalJoint.
joint link parent links{0} to-child links{1}
with-parent-point (0, -1.0, 0) with-child-point (0, 1.0, 0) with-normal (1, 0, 0).
joint set-strength-limit to 100.
return self.
}
UniversalJoint : ExampleUniversalJoint
{
+ to iterate:
x (double).
x = sin((controller get-time) / 15) / 2.
self set-joint-velocity axis-1 x axis-2 0.01.
}
EDIT: I just tried copying & pasting the code from this post to a blank breve document, but it seems that the web page added a lot of weird control characters and it doesn't work at all. I can send you the test file if you need it.

transform world-vector bug (breve 2.4 beta)
copy/pasteing your example works fine on my computer.
(EDIT:) (And edit again: sorry)
BTW: really nice trick, that motion-trail! :D
transform world-vector bug (breve 2.4 beta)
Rxke wrote:copy/pasteing your example works fine on my computer.
I tried again and it didn't work. Since it worked for you, I decided to try opening this thread in Firefox instead of Safari and it worked! Are you using Firefox? It seems that Firefox copies text as "plain text" whereas Safari copies all the styles too, and that appears to be what confuses the breve editor.
Rxke wrote:BTW: really nice trick, that motion-trail! :D
Thanks! Note that this simplified example is missing a + destroy method (with a call to "trail clear", since "free trail" seems to crash the simulation :? )
Re: transform world-vector bug (breve 2.4 beta)
PowerMacX wrote:Calling Link's superclass method (transform world-vector) always returns null.
Thanks for the report -- it's fixed now.
Quote:
Also, I made a simple test breve script to make testing easier, based on the JointTypeExample.tz (under the Demos>Programming-Examples menu), but found out that both the example and my test script produce a continuous stream of "unknown atomic type 0 in slFormatEvaluation" messages in the log window.
Thanks, this was a very similar bug -- it's fixed now as well!
- jon
transform world-vector bug (breve 2.4 beta)
PowerMacX wrote:Are you using Firefox?
Ah, yes, indeed. I thought about mentioning it, but then edited it out, because I mistakenly thought that would not make a difference, heh.
transform world-vector bug (breve 2.4 beta)
I downloaded the new OS X version (2.4b Feb 26) but while the errors disappeared, so did the motion of the simulated joint! :(
Both the test script I built to pinpoint the original bug as well as the JointTypeExample.tz demo (under the Demos>Programming-Examples menu) fail to show any motion. Strangely, other demos seem to work fine (?).