|
Choons, Sr. Member
Posted: 21 June 2011 04:25 AM Total Posts: 281
been banging my head against a wall trying to figure out why the plane I am applying a lookAt(view.camera.position) to becomes invisible in my scene. If I change the material to bothSides = true the plane becomes visible. So apparently the plane doesn’t lookAt the specified position with the side the material is applied to. Setting bothSides = true on the material seems a likely waste of resources since there’s no way I can ever see the other side of the plane with it always facing the camera.
The only reason I’m trying to do this with a plane instead of a Sprite3D is because I rotate the camera about the axis along its line of sight which also causes Sprite3D’s to rotate along that axis as well. That’s a big problem if you are using Sprite3D’s for trees or clouds for instance. I’m fine with using a plane instead, but I’d expect that lookAt(view.camera.position) on a plane would behave the same as how a Sprite3D faces the camera with its textured side.
|
|
Choons, Sr. Member
Posted: 21 June 2011 08:38 AM Total Posts: 281
[ # 2 ]
thanks for the reply, but frankly why should I have to do that? I can’t think of a good reason that lookAt on a plane doesn’t automatically orient the plane with the textured side toward the position in question.
|
John Brookes, Moderator
Posted: 21 June 2011 08:56 AM Total Posts: 732
[ # 3 ]
All the primitives have a forward along the zAxis.
So I guess the reason is why the plane material is (on the wrong side) when added to the scene, with a default camera, is its visible.
//Flip the face
MeshHelper.invertFaces(plane);
or invert the camera postion passed to lookat
var invCamPos:Vector3D = view.camera.position.clone();
invCamPos.negate();
plane.lookAt(invCamPos);
or just use doubleSided, the other side isnt drawn.
|
Choons, Sr. Member
Posted: 21 June 2011 05:15 PM Total Posts: 281
[ # 4 ]
thanks, John. You always have great solutions. Actually when I add the plane to the scene it is visible with bothSides = false on the material. It’s only when I do plane.lookAt(view.camera.position) that it becomes invisible. Seems to me that shouldn’t happen without needing helpers or additional manipulations
|
Manuel L., Member
Posted: 13 December 2012 02:05 PM Total Posts: 99
[ # 5 ]
hey guys, i have a similar problem.
i have created a plane on which i put a material of a woman.
everything is okay, but i want that this plane is always looking at the camera position, so nobody can go behind the person to see that it is a plane. no big deal i thought, but when i start the lookAt(view.camera.position), the (plane) woman goes from vertical to horizontal and is (f)lying.
So my question, how can i set the point of the plane, that is lookingAt?
Which point is the criterion of the lookAt? Do You understand what i mean?
|
Manuel L., Member
Posted: 18 December 2012 09:54 AM Total Posts: 99
[ # 6 ]
|
John Brookes, Moderator
Posted: 18 December 2012 11:24 AM Total Posts: 732
[ # 7 ]
var camPos:Vector3D = view.camera.position.clone();
camPos.negate();
camPos.y = plane.y;
plane.lookAt(camPos);
|