- Home /
Question about iTween Uneven Terrain example.
Hi,
I'm somewhat baffled by my attempts to understand the iTween uneven terrain example. The example scene (for Javascript) works fine, but when I attempt to recreate the behaviour in a scene of my own it doesn't work. I've copied all the elements of the example scene component for component, I have the Puppeteer script in an empty gameobject, I have told it to use my character and arrow objects, and I have placed iTween itself in a Plugins folder in my project view.
On running the scene, first the Arrow object doesn't track my mouse movements as it does in the example. If I click anywhere then the Character object moves to the position of the Arrow object (which remains where it was placed in the scene view), but does so almost instantly, with no nice smooth movement in between as in the example.
I have no idea what I might be missing; I created a simple project and scene to test this and everything looks exactly the same as the example scene.
Can anyone help me with this?
I really don't know, always wondered too... An idea I've had though, is give the moving object a rigid body, then just move it across the bottom-most part of the ground... The physics would handle the up and down then? And then I'd assume you'd have to go by the speed, not time... If this works, comment back, if not, if you find a solution, post please =).
Answer by Drum · Apr 01, 2011 at 01:35 PM
Ok, I've prodded this a bit more and I've found what i was overlooking. Nothing to do with iTween in fact, but the figures in the puppeteer script for the raycasting are set for a terrain/object of the size in the example (50x50) where I was trying to use the same script on a much larger area. So, a line which read:
Physics.Raycast (cameraRay.origin,cameraRay.direction,hit, 50);
I changed to:
Physics.Raycast (cameraRay.origin,cameraRay.direction,hit, 500);
and it started working! :)
I also tweaked the time figures for the actual iTween call so that it looked better over the greater distance.
Sorry for the confusion, but I have learned quite a lot by solving this (mostly to read the documentation for EVERYTHING, not just what I think is giving the problem).
Answer by pixelplacement · Mar 31, 2011 at 09:25 PM
I can't recall everything I put into that example but one thing to look for is to make sure the object that is going to be riding along your terrain is in a layer that is being ignored by raycast otherwise the system will never be able to read the surface for a successful scan of the terrain and will instead think your object is the ground. Make sense?
Yes, the moving character is in a layer called 'ignore raycast'. I think the reason I am confused is because there is so very little in that scene. A couple of gameobjects, a mesh terrain, and an empty gameobject to hold the puppeteer script, and that's basically it!
When I have more time over the weekend I am going to try importing the assets from the example one by one in to a new project. At some point it has to work doesn't it?
Your answer
Follow this Question
Related Questions
NPCs following an uneven floor... 0 Answers
Make a simple tree 1 Answer
iTween - Rotation Add get's uneven after several rotations 2 Answers
iTweenPath auto keep on terrain 1 Answer
what is the easiest way to do a moving car on uneven terrain 1 Answer