A while a go, I wrote something that took advantage of exactly what I'm talking about..     <br><br>I added my own character class called, 'Character',  to manage some internal data like way-points...   but that's not required.<br>
<br>Should be something like:<br><br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
public class Character : IClientAPI<br>        internal void AutoPilot(Vector3 vector3, uint localid)<br>        {<br>            UpdateVector ap = OnAutoPilotGo;<br>            if (ap != null)<br>                ap(localid, vector3, this);<br>
        }<br></blockquote></blockquote>In the script engine there would be a timer or some other time based trigger..   like the EventManager OnFrame event.<br><br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
 private Quaternion fourtyFiveDegreeAngle = new Quaternion(0,0,-0.70711f,0.70711f);<br>void EventManager_OnFrame()<br>        {<br>            m_frame++;<br>            if ((m_frame % m_agentupdatepump) == 0)<br>            {<br>
                PumpAgentUpdate();<br>            }<br>            if (m_frame >= (int.MaxValue - 1))<br>            {<br>                m_frame = 0;<br>            }<br>        }<br> void PumpAgentUpdate()<br>        {<br>
            foreach (Character c in ActiveCharacters)<br>           {<br>           ScenePresence cSP = m_scene.GetScenePresence(c.AgentId);<br>           PumpAgentUpdate(c, cSP);<br>           }<br>        }<br><br>// NOTE HERE how we're doing a bit of math to figure out our appropriate rotation! to feed back to the agent update method<br>
void PumpAgentUpdate(Character pC, ScenePresence pSP)<br>        {<br>            AgentUpdateArgs updateargs = new AgentUpdateArgs();<br>            updateargs.AgentID = pC.AgentId;<br>            updateargs.BodyRotation = Vector3.RotationBetween(Vector3.UnitX, Vector3.Normalize(pC.m_lastTarget - pSP.AbsolutePosition));<br>
            if (pC.ClientSideOrientation == fourtyFiveDegreeAngle)<br>                pC.ClientSideOrientation = Quaternion.Identity;<br>            updateargs.CameraAtAxis = Vector3.Zero;<br>            updateargs.CameraCenter = new Vector3(pSP.AbsolutePosition  - (new Vector3(0,0,1) * updateargs.BodyRotation));<br>
            updateargs.CameraLeftAxis = Vector3.Zero;<br>            updateargs.CameraUpAxis = Vector3.Zero;<br>            updateargs.ControlFlags = uint.MinValue;// +(uint)OpenMetaverse.AgentManager.ControlFlags.AGENT_CONTROL_FLY;<br>
            updateargs.Far = 128f;<br>            updateargs.Flags = byte.MinValue;<br>            updateargs.HeadRotation = Quaternion.Identity;<br>            updateargs.SessionID = pC.SessionId;<br>            updateargs.State = byte.MinValue;<br>
            <br>            pSP.HandleAgentUpdate(pC,updateargs);<br>        }</blockquote>       <br><br>Note that last method call.   That's probably the minimum AgentUpdateArgs that you can construct.<br><br>Anyway, if we're using the NPC character in the script engine, then this type of stuff should probably be handled in the Async area of the Script engine.  Hopefully this helps.<br>
<br>-Teravus<br><br>On Tue, Jul 12, 2011 at 10:02 PM, Teravus Ovares <<a href="mailto:teravus@gmail.com">teravus@gmail.com</a>> wrote:<br>> In order to fix the autopilot, the script engine needs to feed the<br>> ScenePresence minimal position/rotation updates.   There's an event<br>
> handler in ScenePresence that handles AvatarUpdates and is the proper<br>> method for the script engine to call.   Last I checked, the server<br>> side autopilot code is IN that event handler, so, unless something has<br>
> significantly changed, it just needs to be wired up.<br>><br>> Teravus<br>><br>> On Tue, Jul 12, 2011 at 8:55 PM, Justin Clark-Casey<br>> <<a href="mailto:jjustincc@googlemail.com">jjustincc@googlemail.com</a>> wrote:<br>
>> On 12/07/11 14:53, David Burden wrote:<br>>>><br>>>>  From my experience and what I've read elsewhere both the LibOMV Autopilot<br>>>> function in OpenSim and the osNPC<br>>>> functionality are broken in the latest versions of OpenSim. Since one of<br>
>>> my favourite uses for virtual worlds is playing<br>>>> around autonomous avatars this is a real pain. Has anyone got any idea of<br>>>> the amount of effort needed to fix one or both<br>>>> of these, as if it's reasonable and practical we might be able to find<br>
>>> some resource to help fix them.<br>>><br>>> Hi David.  As it happens, I've started to look at osNPC*() functions in the<br>>> last couple of weeks (e.g. commits 22f25fa, ed12e38) with a view to<br>
>> eventually restoring the original functionality and buttressing it with some<br>>> automated regression tests.  I would also love to see the code in a state<br>>> where NPCs would work without a client object attached.<br>
>><br>>> At the moment in git master, say, create and delete work, though appearance<br>>> and autopilot are broken.  For an experienced OpenSim developer fixing<br>>> appearance shouldn't be too hard - I think it's a case of digging around to<br>
>> find out why the copied avatar baked textures aren't being used properly on<br>>> the NPC.<br>>><br>>> Fixing autopilot is more difficult.  In principle, it should use much the<br>>> same code paths as sit and "go here" on version 1 viewers, though "go here"<br>
>> itself doesn't appear to be working consistently.  It's probably a case of<br>>> fixing go and then reusing the code for npc autopilot.  This would be<br>>> somewhat involved, more so than fixing appearance.  Fixing autopilot of NPCs<br>
>> should also fix it for client-side bots.<br>>><br>>> Any resource to help fix these would be very welcome.  I have to confess,<br>>> they are low down on my priority list right now.<br>>><br>
>> --<br>>> Justin Clark-Casey (justincc)<br>>> <a href="http://justincc.org/blog">http://justincc.org/blog</a><br>>> <a href="http://twitter.com/justincc">http://twitter.com/justincc</a><br>>> _______________________________________________<br>
>> Opensim-users mailing list<br>>> <a href="mailto:Opensim-users@lists.berlios.de">Opensim-users@lists.berlios.de</a><br>>> <a href="https://lists.berlios.de/mailman/listinfo/opensim-users">https://lists.berlios.de/mailman/listinfo/opensim-users</a><br>
>><br>><br><br>