Only launch a prims script(s) when adding the prim, not on every update.
Rename Bird prims to OpenSimBirdsN where N is 0-birdcount.pull/1/merge
parent
c487d9b945
commit
45fd724e56
|
@ -111,7 +111,7 @@ namespace Flocking
|
|||
{
|
||||
m_flowMap = flowMap;
|
||||
for (int i = 0; i < num; i++) {
|
||||
AddBird ("Bird"+i );
|
||||
AddBird (m_name + i );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,30 +88,28 @@ namespace Flocking
|
|||
SceneObjectPart rootPart;
|
||||
|
||||
if (existing == null) {
|
||||
m_log.InfoFormat("[{0}]: Adding prim {1} from region {2}", m_name, bird.Id, m_scene.RegionInfo.RegionName);
|
||||
SceneObjectGroup group = findByName (m_birdPrim);
|
||||
sog = CopyPrim (group, bird.Id);
|
||||
rootPart = sog.RootPart;
|
||||
//set prim to phantom
|
||||
sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false);
|
||||
m_sogMap [bird.Id] = sog;
|
||||
m_log.InfoFormat("[{0}]: Adding prim {1} from region {2}", m_name, bird.Id, m_scene.RegionInfo.RegionName);
|
||||
m_scene.AddNewSceneObject (sog, false);
|
||||
} else {
|
||||
sog = existing.ParentGroup;
|
||||
m_sogMap[bird.Id] = sog;
|
||||
//m_log.InfoFormat("[{0}]: Reusing prim {1} from region {2}", m_name, bird.Id, m_scene.RegionInfo.RegionName);
|
||||
rootPart = sog.RootPart;
|
||||
//set prim to phantom
|
||||
sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false);
|
||||
}
|
||||
|
||||
Quaternion rotation = CalcRotationToEndpoint (sog, sog.AbsolutePosition, bird.Location);
|
||||
sog.UpdateGroupRotationPR( bird.Location, rotation);
|
||||
|
||||
// Fire script on_rez
|
||||
sog.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 1);
|
||||
rootPart.ParentGroup.ResumeScripts();
|
||||
rootPart.ScheduleFullUpdate();
|
||||
} else {
|
||||
sog = existing.ParentGroup;
|
||||
m_sogMap[bird.Id] = sog;
|
||||
//rootPart = sog.RootPart;
|
||||
//set prim to phantom
|
||||
//sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false);
|
||||
}
|
||||
|
||||
Quaternion rotation = CalcRotationToEndpoint (sog, sog.AbsolutePosition, bird.Location);
|
||||
sog.UpdateGroupRotationPR( bird.Location, rotation);
|
||||
}
|
||||
|
||||
private static Quaternion CalcRotationToEndpoint (SceneObjectGroup copy, Vector3 sv, Vector3 ev)
|
||||
|
|
Loading…
Reference in New Issue