SetCamera() function.
-
first of all: i know nothing about ruby. i wanted to use the setCamera() function introduced in sp 3.1 but dont kno how. what i want to achieve is something like the camera script from the lazy script where you could make an object into a camera. when you play the animation the camera is positioned inside this object and is moving together with the object. any hints?
-
Put this in the Scripted field of a group and it should work
ontick{ eye = position target = transformation.zaxis up = [0,0,1] camera.set(eye, target, up) }
It will look from the center towards the Z axis of your group, so remove the top cover and orient it how you want, or attach it to something.
With ontick there will be a 1 frame delay between the camera and the group, this can be very useful for vehicles as the camera starts to stretch and it's an easy speed effect.
Change ontick into onpostframe and the camera stretch will be gone. -
Well actually it doesn't work. it worked few times for me but i dont know what am i doing wrong. will it work with sp3.2? and gsu 7?
-
Ok i got it to work. the box with the script must not be laying flat on the ground it needs to be in the air so it would movw (fall down) when the animation starts. But the other thing is that the camera doesn't tilt when the scripted box is being tilted. it always follows the line of horizon. Can that be changed?
-
Oh I forgot to mention the camera has issues looking straight up.
The up = [0,0,1] defines the camera up vector, you can change that to up = transformation.yaxis or xaxis and it will tilt along with the box.
-
This works perfect now. Thanks
Advertisement