Building 3D shapes in Roassal with interaction. Unexpected behaviour?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Building 3D shapes in Roassal with interaction. Unexpected behaviour?

Lusa Nicolas
Hello everyone,

It has been a while since I started working with Woden and Roassal and I recently figured out that something is behaving unexpectedly (at least from my point of view).

Assume we create 3 shapes (all the same kind) with Roassal (i.e. 3 RWPyramid) and we associate an eventListener to see when someone click on the object. In such case we change the color of the shape. Here is the code:

v := RWView new.

e := (RWPyramid new) element.
e on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor blue.
        ev element changed.
].
v add: e.

g := (RWPyramid new) element.
g on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor green.
        ev element changed.
].
g translateBy:(WDVector3 newX: 4.0 y: 0.0 z: 0.0).
v add: g .

f := (RWPyramid new) element.
f on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor red.
        ev element changed.
].
f translateBy:(WDVector3 newX: 2.0 y: 0.0 z: 0.0).
v add: f.

v addInteraction: RWMouseKeyControl.
v camera position: (WDVector3 x: 0.0 y: 0.0 z: 3.0).
v open.

So far, so good. But now, let's try to change some objects type, (i.e. let's put a Pyramid a Cube and a Cylinder). Here is the code:

v := RWView new.

e := (RWPyramid new) element.
e on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor blue.
        ev element changed.
].
v add: e.

g := (RWCube new) element.
g on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor green.
        ev element changed.
].
g translateBy:(WDVector3 newX: 4.0 y: 0.0 z: 0.0).
v add: g .

f := (RWCylinder new) element.
f on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor red.
        ev element changed.
].
f translateBy:(WDVector3 newX: 2.0 y: 0.0 z: 0.0).
v add: f.

v addInteraction: RWMouseKeyControl.
v camera position: (WDVector3 x: 0.0 y: 0.0 z: 3.0).
v open.

Now if you try this, and you'll try to click on the Pyramid, you will see that the cube is the one that gets to change color but not the Pyramid. Same if you click on the Cylinder.
I think the code that I wrote is correct, but I might be wrong.
Does anyone know what is the problem due?

Cheers,
Nicolas



Reply | Threaded
Open this post in threaded view
|

Re: Building 3D shapes in Roassal with interaction. Unexpected behaviour?

Ronie Salgado
Hello Nicolas,

Thanks for pointing this bug. I just fixed it in Woden-Core-RonieSalgado.64 . Can you try again?

Greetings,
Ronie

2015-01-28 10:40 GMT-03:00 Nicolas Lusa <[hidden email]>:
v := RWView new.

e := (RWPyramid new) element.
e on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor blue.
        ev element changed.
].
v add: e.

g := (RWCube new) element.
g on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor green.
        ev element changed.
].
g translateBy:(WDVector3 newX: 4.0 y: 0.0 z: 0.0).
v add: g .

f := (RWCylinder new) element.
f on: RWMouseButtonDown do: [ :ev |
        ev element shape color: WDColor red.
        ev element changed.
].
f translateBy:(WDVector3 newX: 2.0 y: 0.0 z: 0.0).
v add: f.

v addInteraction: RWMouseKeyControl.
v camera position: (WDVector3 x: 0.0 y: 0.0 z: 3.0).
v open.