aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-23 05:56:35 +0000
committerTeravus Ovares2007-11-23 05:56:35 +0000
commit1ecd803e87119c0344b91798792130155a82859c (patch)
tree74cbd2102051d03acfa78f5763438fd0b0a19778 /OpenSim/Region/Environment/Scenes/Scene.cs
parentFixed Terrain rescale command (diff)
downloadopensim-SC_OLD-1ecd803e87119c0344b91798792130155a82859c.zip
opensim-SC_OLD-1ecd803e87119c0344b91798792130155a82859c.tar.gz
opensim-SC_OLD-1ecd803e87119c0344b91798792130155a82859c.tar.bz2
opensim-SC_OLD-1ecd803e87119c0344b91798792130155a82859c.tar.xz
* added some functions for use in raytracing. They're kind of crappy now, so they only display 'guesses' on the console when you rez a prim.
* any math gurus who'd like to improve rezzing need only to make the raytracer in SceneObjectPart work :D
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 90306f2..ef96e3d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -635,8 +635,52 @@ namespace OpenSim.Region.Environment.Scenes
635 /// <param name="ownerID"></param> 635 /// <param name="ownerID"></param>
636 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) 636 public void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape)
637 { 637 {
638
639 // What we're *supposed* to do is raytrace from the camera position given by the client to the nearest collision
640 // in the direction the client supplies (the ground level that we clicked)
641 // This function is pretty crappy right now.. so we're not affecting where the newly rezzed objects go
642 // Test it if you like. The console will write where it guesses a collision took place. if it thinks one did.
643 // It's wrong many times though.
644
638 if (PermissionsMngr.CanRezObject(ownerID, pos)) 645 if (PermissionsMngr.CanRezObject(ownerID, pos))
639 { 646 {
647 Vector3 CameraPosition = ((ScenePresence)GetScenePresence(ownerID)).CameraPosition;
648 Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z);
649
650 float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd);
651
652 Vector3 rayDirection = new Vector3(rayEnd.x / raydistance, rayEnd.y / raydistance, rayEnd.z / raydistance);
653
654 Ray rezRay = new Ray(CameraPosition, rayDirection);
655
656
657 Vector3 RezDirectionFromCamera = rezRay.Direction;
658
659 EntityIntersection rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay);
660
661 if (rayTracing.HitTF)
662 {
663 // We raytraced and found a prim in the way of the ground.. so
664 // We will rez the object somewhere close to the prim. Better math needed. This is a Stub
665 //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z);
666 Vector3 Newpos = rayTracing.ipoint;
667 Vector3 NewScale = new Vector3(rayTracing.obj.Scale.X,rayTracing.obj.Scale.Y,rayTracing.obj.Scale.Z);
668
669 Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation;
670 //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z);
671
672 LLQuaternion primLocalRot = rayTracing.obj.RotationOffset;
673 Quaternion LocalRot = new Quaternion(primLocalRot.W,primLocalRot.X,primLocalRot.Y,primLocalRot.Z);
674
675 Quaternion NewRot = LocalRot * ParentRot;
676
677 Vector3 RezPoint = Newpos;
678
679 MainLog.Instance.Verbose("REZINFO","Possible Rez Point:" + RezPoint.ToString());
680 //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z);
681
682 }
683
640 SceneObjectGroup sceneOb = 684 SceneObjectGroup sceneOb =
641 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); 685 new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape);
642 AddEntity(sceneOb); 686 AddEntity(sceneOb);