[realXtend] Synchronization in clients in Tundra
Hi all, I have a character moving to-n-fro (along the Z-axis) in the scene. I have written the following script for this. When I choose the run mode to server, the script doesn't execute but when I switch to both (client and sever), animation runs smoothly with the single client but when I connect multiple clients, the animation is jerky. Am I missing anything simple?? or Is there anything wrong with the script?? var entityNameToFind = UrbanMale.; var animationNameToStart = Walk; var availableAnims=0; var delta = -0.005; var s = 1; function StartAnimation() { var objectToAnimate = scene.GetEntityByName(entityNameToFind); if (objectToAnimate != null objectToAnimate.animationcontroller != null) { if(availableAnims=0) frame.DelayedExecute(1.0).Triggered.connect(StartAnimation); availableAnims = objectToAnimate.animationcontroller.GetAvailableAnimations(); var animFound = false; for(var i=0; iavailableAnims.length; i++) { if (availableAnims[i] == animationNameToStart) { animFound = true; break; } } if (animFound) { objectToAnimate.animationcontroller.EnableAnimation(animationNameToStart, true); objectToAnimate.animationcontroller.SetAnimSpeed(Walk,0.6); } var trans = me.placeable.transform; trans.pos.z = -5; trans.rot.x = 0; trans.rot.y = 180; trans.rot.z = 0; me.placeable.transform = trans; frame.DelayedExecute(0.5).Triggered.connect(updatePosition); } else { frame.DelayedExecute(1.0).Triggered.connect(StartAnimation); } } if (!server.IsRunning() !framework.IsHeadless()) { StartAnimation(); } function updatePosition(dt) { var tm = me.placeable.transform; if(tm.pos.z = -24 tm.pos.z = 2) { tm.pos.z += (s*delta); } else { tm.rot.y += 180; tm.pos.z += (s*2); s *= -1; tm.rot.y %= 360; } me.placeable.transform = tm; frame.DelayedExecute(0.01).Triggered.connect(updatePosition); } I have used the RigidBody component for the character (as well as terrain), but I see the character legs getting into the terrain in high areas. How can I make character clamp on the terrain?? Regards, Vaibhav -- http://groups.google.com/group/realxtend http://www.realxtend.org
Re: [realXtend] Synchronization in clients in Tundra
On Apr 25, 2012, at 10:35 AM, Vaibhav Vaidya wrote: I have a character moving to-n-fro (along the Z-axis) in the scene. I have written the following script for this. When I choose the run mode to server, the script doesn't execute but when I switch to both (client and sever), animation runs smoothly with the single client but when I connect multiple clients, the animation is jerky. Am I missing anything simple?? or Is there anything wrong with the With this setup all the clients run it individually on the client side, and have their own opinion about the exact position, which they all communicate to the server which then replicates the changes to all the clients .. so it gets jerky. Correct is to do the modification only in one place, and have that replicate over the net. Either on the server or one of the clients. With this code you disable it on the server - don't do that, if you want to run it on a server :) if (!server.IsRunning() !framework.IsHeadless()) { StartAnimation(); } ~Toni var entityNameToFind = UrbanMale.; var animationNameToStart = Walk; var availableAnims=0; var delta = -0.005; var s = 1; function StartAnimation() { var objectToAnimate = scene.GetEntityByName(entityNameToFind); if (objectToAnimate != null objectToAnimate.animationcontroller != null) { if(availableAnims=0) frame.DelayedExecute(1.0).Triggered.connect(StartAnimation); availableAnims = objectToAnimate.animationcontroller.GetAvailableAnimations(); var animFound = false; for(var i=0; iavailableAnims.length; i++) { if (availableAnims[i] == animationNameToStart) { animFound = true; break; } } if (animFound) { objectToAnimate.animationcontroller.EnableAnimation(animationNameToStart, true); objectToAnimate.animationcontroller.SetAnimSpeed(Walk,0.6); } var trans = me.placeable.transform; trans.pos.z = -5; trans.rot.x = 0; trans.rot.y = 180; trans.rot.z = 0; me.placeable.transform = trans; frame.DelayedExecute(0.5).Triggered.connect(updatePosition); } else { frame.DelayedExecute(1.0).Triggered.connect(StartAnimation); } } if (!server.IsRunning() !framework.IsHeadless()) { StartAnimation(); } function updatePosition(dt) { var tm = me.placeable.transform; if(tm.pos.z = -24 tm.pos.z = 2) { tm.pos.z += (s*delta); } else { tm.rot.y += 180; tm.pos.z += (s*2); s *= -1; tm.rot.y %= 360; } me.placeable.transform = tm; frame.DelayedExecute(0.01).Triggered.connect(updatePosition); } I have used the RigidBody component for the character (as well as terrain), but I see the character legs getting into the terrain in high areas. How can I make character clamp on the terrain?? Regards, Vaibhav -- http://groups.google.com/group/realxtend http://www.realxtend.org -- http://groups.google.com/group/realxtend http://www.realxtend.org
snap to terrain (Re: [realXtend] Synchronization in clients in Tundra)
On Apr 25, 2012, at 10:35 AM, Vaibhav Vaidya wrote: I have used the RigidBody component for the character (as well as terrain), but I see the character legs getting into the terrain in high areas. How can I make character clamp on the terrain?? what collision type is the rigidbody? in animation code with moving characters and a heightmap based terrain this can be useful: var p = terrain.GetPointOnMap(tm.pos); //the point on the terrain at this location - i.e. gives the current land height is in use in http://www.realxtend.org/world/lvm-tundra2/deer2.js (function updatePosition(dt)) which is up-to-date -- Jukka touched it previously in February or so I think after I originally made it (after ludo-Heikki's initial work), and did core enchancements for the terrain to support animation things at the same time. Vaibhav ~Toni -- http://groups.google.com/group/realxtend http://www.realxtend.org
Re: snap to terrain (Re: [realXtend] Synchronization in clients in Tundra)
Thanks Toni.. On Wed, Apr 25, 2012 at 1:21 PM, Toni Alatalo t...@playsign.net wrote: On Apr 25, 2012, at 10:35 AM, Vaibhav Vaidya wrote: I have used the RigidBody component for the character (as well as terrain), but I see the character legs getting into the terrain in high areas. How can I make character clamp on the terrain?? what collision type is the rigidbody? in animation code with moving characters and a heightmap based terrain this can be useful: var p = terrain.GetPointOnMap(tm.pos); //the point on the terrain at this location - i.e. gives the current land height is in use in http://www.realxtend.org/world/lvm-tundra2/deer2.js (function updatePosition(dt)) which is up-to-date -- Jukka touched it previously in February or so I think after I originally made it (after ludo-Heikki's initial work), and did core enchancements for the terrain to support animation things at the same time. Vaibhav ~Toni -- http://groups.google.com/group/realxtend http://www.realxtend.org -- http://groups.google.com/group/realxtend http://www.realxtend.org
[realXtend] AJET special issue on virtual worlds published
Dear colleagues, We are pleased to announce that the much-awaited Australasian Journal of Educational Technology (AJET) special issue on Virtual Worlds in Tertiary Education, guest edited by Mark J. W. Lee (Charles Sturt University and University of New England), Barney Dalgarno (Charles Sturt University) and Helen Farley (University of Southern Queensland) has now been published. The guest editorial and all eight articles that constitute the special issue are freely available from the AJET website at http://www.ascilite.org.au/ajet . Please feel free to spread the word about the special issue to colleagues at your institution and elsewhere who might be interested, and through the various networks and associations of which you are part. Kind regards, Mark J.W. Lee, Barney Dalgarno and Helen Farley Guest Editors, AJET special issue - Virtual worlds in tertiary education: An Australasian perspective Email: ajet.virtualwor...@gmail.com Charles Sturt University | ALBURY-WODONGA | BATHURST | CANBERRA | DUBBO | GOULBURN | MELBOURNE | ONTARIO | ORANGE | PORT MACQUARIE | SYDNEY | WAGGA WAGGA | LEGAL NOTICE This email (and any attachment) is confidential and is intended for the use of the addressee(s) only. If you are not the intended recipient of this email, you must not copy, distribute, take any action in reliance on it or disclose it to anyone. Any confidentiality is not waived or lost by reason of mistaken delivery. Email should be checked for viruses and defects before opening. Charles Sturt University (CSU) does not accept liability for viruses or any consequence which arise as a result of this email transmission. Email communications with CSU may be subject to automated email filtering, which could result in the delay or deletion of a legitimate email before it is read at CSU. The views expressed in this email are not necessarily those of CSU. Charles Sturt University in Australia http://www.csu.edu.au The Chancellery, Panorama Avenue, Bathurst NSW Australia 2795 ABN: 83 878 708 551; CRICOS Provider Numbers: 5F (NSW), 01947G (VIC), 02960B (ACT) Charles Sturt University in Ontario http://www.charlessturt.ca 860 Harrington Court, Burlington Ontario Canada L7N 3N4 Registration: www.peqab.ca Consider the environment before printing this email. -- http://groups.google.com/group/realxtend http://www.realxtend.org