|
The CharacterController needs to get on and off translating and rotating surfaces without parenting, which does not work without messing with the hierarchy. I can get a collided objects hit point, the offset of that from its axis and the position and rotation of the controller. It updates on FixedUpdate(). However, I cannot figure out the proper use or combination of Vector3 or Quaternion or transform.rotation.eulerAngles to get the controller to behave like it is on a moving (translating) object that may be turning, tilting or rotating as well. It would seem to e to be a very useful piece of code for most game style and should probably be integrated wherever it is best (console kept telling me it didn't like where I was putting these vars) as a built in method "RideOnObject". I would post the code I am playing with but it will change ten minutes from now. If I strike it rich I will post the javascript. edit:I checked the scripts out from answer 694. The last one threw too many errors in the console to even start debugging and rearranging the code. I have set up the first simpler script with appropriate inputs but am looking at the var calculatedMove which I have yet to assign a value to because I am wondering if I can retrieve that value somehow from the CharacterController script or the FPSWalker script and whether the MouseLook value should be incorporated. Or should I write my own move calculation? As well, I noted that when you add a script it automatically goes underneath the ones there and you cannot change order. If they fire off from top to bottom the does the bottom script translation and rotation of the CharacterController override the values from the script higher up the Inspector list? Thanks for the meat of the answer.I was doing very similar routines but the quaternion versus Vector3 and how to get them to play together flipping from world to local and translating that back to world after updating the tracked local point position of collision was kicking my butt. I now have all that and am digging into how to control the Move. I then assign that value to calculatedMove and I can then test on any number of tagged objects. What's the trick here? Best Regards and TIA
(comments are locked)
|
|
Here is my script I can drop on a CharacterController or select one from the dropdown list in the inspector. I have done rudimentary testing on a rotating platform as I figured that was more of a trick than just a translating platform. To use it tag those surfaces with a "MovingSurface" tag so the OnCharacterColliderHit can find the name of the tag and implement the algorithm if the hitObject tag == "MovingSurface". Thanks to those I stood on the shoulders of to finally get this. Now for coffee. It works fabulousy xcept one item. How do I get the CharacterControler to follow the rotation of a merry-go-round for instance. The CC can get on and is dragged around but the view from their camera does not rotate with the platform and looks in the same absolute direction as prior to boarding.
Feb 14 '10 at 01:17 PM
Rblain
i'm getting this error: Assets/CharStickPlatform.js(26,44): BCE0020: An instance of type 'FPSWalker' is required to access non static member 'speed'. I'll probably have to refer to my own script for moving around but that gives the same error. What should I do?
Feb 25 '10 at 07:44 PM
CracksisT
(comments are locked)
|
