RaycastPicker:getSceneCollision doesn’t work

Software: Away3D 4.x

rembrant, Newbie
Posted: 16 August 2012 01:21 PM   Total Posts: 2

Hellow! I try to find collision from my camera to scene with RaycastPicker:getSceneCollision, for example:

var picker:RaycastPicker = new RaycastPicker(false//or true, insignificantly
var VO:PickingCollisionVO picker.getSceneCollision(new Vector3D(_view.camera.x_view.camera.y_view.camera.z), new Vector3D(_view.camera.x, -1_view.camera.z), _view.scene);

_view is my View3D
But getSceneCollision returns null at any values of parameters “position” and “direction”
Please, help me to find my mistake.


rembrant, Newbie
Posted: 17 August 2012 06:02 AM   Total Posts: 2   [ # 1 ]

Yesterday I tried to get the collision object from the scene position with RaycastPicker:getSceneCollision but it allways returned null to me.
After this I found sources of this class and body of this function was:

 * @inheritDoc
public function getSceneCollision(position:Vector3Ddirection:Vector3Dscene:Scene3D):PickingCollisionVO
//cast ray through the scene
 // Evaluate new colliding object.
return null;

Please tell my, why this function is empty? It’s very necessary for my work…


Richard Olsson, Administrator
Posted: 17 August 2012 08:03 AM   Total Posts: 1192   [ # 2 ]

Please do not double-post. I merged your threads.

This function is just a placeholder for a functionality that will be added in a later version of the engine, and a function that didn’t even exist until recently. If you desperately need it you are encouraged to implement it yourself and then create a pull request and we might include your implementation in the engine.


theMightyAtom, Sr. Member
Posted: 14 July 2016 12:02 PM   Total Posts: 669   [ # 3 ]

I fell for this one today, 4 years later.
There is some code in there now, but it still always causes an error for me.

Are there any alternatives to Raycastpicker?


UPDATE: I updated my repository and it almost works, but doesn’t always return the object you’d expect. Time to extend and hack… yum!


rdoi, Member
Posted: 14 July 2016 03:41 PM   Total Posts: 86   [ # 4 ]

I’ve played a little with them some time ago, and it worked ok.
What exactly is the problem?


theMightyAtom, Sr. Member
Posted: 14 July 2016 03:44 PM   Total Posts: 669   [ # 5 ]

If there are several objects under the ray it sometimes takes the closest, sometimes not. I’ve solved it with my own quick depth test.

What confused me for a long time was that the “entity” is not an actual reference to the object, so you have to find it yourself from the name.


rdoi, Member
Posted: 14 July 2016 05:47 PM   Total Posts: 86   [ # 6 ]

It is basically explained in the mouse picker tutorial: http://away3d.com/tutorials/Introduction_to_Mouse_Picking

You have to deal with a set of picker raycast types, pickingCollision and pickingCollider, and also with mouseEnabled states. It is pretty confusing, but once you understands it, it works ok.

Also consider that it is pretty expensive because it traverse the scene everytime.



Away3D Forum

Member Login