away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
640 stars 273 forks source link

Strange uv value with MouseEvent3D on Mesh from 3DS #655

Open JulienRobidet opened 11 years ago

JulienRobidet commented 11 years ago

Hi guys!

I try to get the uv point when i make a MouseEvent3D.MOUSE_DOWN or MouseEvent3D.CLICK.

The MouseEvent3D are added to Mesh 3DS object but the value are so strange, sometimes negative or up to 1 !

My code :

// get object Mesh from MaxLoader mesh = Mesh(e.target.getChildAt(0)); mesh.pickingCollider = PickingColliderType.PB_BEST_HIT; mesh.mouseEnabled = true; mesh.shaderPickingDetails = true; mesh.showBounds = true; _customContainer.addChild(mesh); // mesh.addEventListener( MouseEvent3D.CLICK, onObjectMouseClick ); mesh.addEventListener( MouseEvent3D.MOUSE_DOWN, onObjectMouseDown );

//on the View3D, i have try with RAYCAST_FIRST_ENCOUNTERED and SHADER _view.mousePicker = PickingType.RAYCAST_BEST_HIT;

Trace results : onObjectMouseDown :: (x=-1.2730845106366644, y=-0.4799215527091153) onObjectMouseClick :: (x=-1.2730845106366644, y=-0.4799215527091153) onObjectMouseDown :: (x=0.4307245809631275, y=1.6171833446040405) onObjectMouseClick :: (x=0.4307245809631275, y=1.6171833446040405) onObjectMouseDown :: (x=0.5078431005753847, y=0.29315549028033805) onObjectMouseClick :: (x=0.5078431005753847, y=0.29315549028033805) onObjectMouseDown :: (x=-0.0360301736098147, y=-0.07157051371327405) onObjectMouseClick :: (x=-0.0360301736098147, y=-0.07157051371327405) onObjectMouseDown :: (x=-1.0415662351191055, y=-0.4383013228279313) onObjectMouseClick :: (x=-1.0415662351191055, y=-0.4383013228279313)

Thx for your support !

LucaEstiva commented 11 years ago

Do you speak about:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb206245(v=vs.85).aspx

JulienRobidet commented 11 years ago

Yes, it's the same concept. The MouseEvent3D.uv point return value between 0 and 1 but in case i have negative value or value up to 1 !

It's the same concept in the tutorial https://github.com/away3d/away3d-tutorials-fp11/blob/master/tutorials/picking/overview/src/PickingTutorialListing06.as

JohnBrookes commented 11 years ago

To use PickingColliderType.PB_BEST_HIT; You need to convert the subgeometry to separate buffers. eg myMesh.geometry.convertToSeparateBuffers();

JulienRobidet commented 11 years ago

Yes, Thank You !

It's work fine !

LucaEstiva commented 11 years ago

All ok julienjules ? I know John... and most of the times has reason ! :)

rob-bateman commented 10 years ago

Can we confirm whether this is still an open issue?

JohnBrookes commented 10 years ago

Not an issue. my above comment stands :) Its how pixelBender picking works. See comments in PickingColliderType

UV values with other pickers don't need the convertToSeparateBuffers and they work.