Picking

Software: Away3D 4.x

rammer, Newbie
Posted: 24 August 2012 04:06 PM   Total Posts: 6

Hi,

I’ve imported a 3ds model into a scene. Now I want to click on it and detect the exact point in the mesh I clicked. The events are firing correctly but what I’m getting is a point in the bounding box of the object and not on the object itself.

What I have in my View is:

_view.mousePicker = PickingType.SHADER;

I have the object in a container and in the container I have:

_container.pickingCollider = PickingColliderType.AUTO_BEST_HIT;
_container.shaderPickingDetails = true;

With these settings I’m getting an event with localPosition and scenePosition with a null value.

I’ve tried to set this in the imported mesh:

mesh.pickingCollider = PickingColliderType.PB_BEST_HIT;
mesh.shaderPickingDetails = true;

But as soon I pass the mouse over the model the application crashes in the ShaderPicker.as at line 392 because the uvs vector is null.

Can anyone help please?

   

Ontheronix, Jr. Member
Posted: 28 August 2012 03:24 PM   Total Posts: 37   [ # 1 ]

Have you tried other PickingCollider types?
I use

msh.pickingCollider PickingColliderType.AUTO_FIRST_ENCOUNTERED 

to retrieve the UV.

   

rammer, Newbie
Posted: 28 August 2012 03:38 PM   Total Posts: 6   [ # 2 ]

On the imported mesh or on the container?

   

Ontheronix, Jr. Member
Posted: 28 August 2012 03:45 PM   Total Posts: 37   [ # 3 ]

I think in the child mesh, but I’m not sure.
Also set mouseChildren=true on the parent container

   

rammer, Newbie
Posted: 28 August 2012 03:49 PM   Total Posts: 6   [ # 4 ]

Tryed that. The same :(

Right now I have:

_view.mousePicker = PickingType.SHADER;

_container.mouseEnabled = true;
_container.mouseChildren = true;

(child mesh)
mesh.mouseEnabled = true;
mesh.mouseChildren = true;
mesh.pickingCollider = PickingColliderType.AS3_FIRST_ENCOUNTERED;

and the event I’m getting has localPosition = localNormal = uv = null

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X