ShiVa3D
Moving camera
All about the StoneScriptMoving camera
by Kaldrick » 20 Oct 2011, 14:13
Hello. I have one small question. I was using iPhoneJoypadEmulation2 code to make my own little camera and character movement. With few changes I managed to make it always face -z axis, and that character is automatically moving forward, and can't really move back. But he can slow down - and I'd wish to move camera back, when he does. This is a sample code I use:
Any help?
- Code: Select all
object.matchTranslation ( hObject, hDynObj, object.kGlobalSpace )
object.translate ( hObject, 0, 4.2, 3.5, object.kGlobalSpace )
object.translate (hDynObj, 0, 0, -0.1, object.kGlobalSpace)
local x,y,z = object.getTranslation ( hDynObj, object.kGlobalSpace )
local w,b,d = object.getTranslation ( hObject, object.kGlobalSpace )
object.resetRotation ( hObject, object.kGlobalSpace )
object.setRotation ( hObject, -30, this.nAngleY ( ), 0, object.kGlobalSpace )
object.rotate ( hObject, this.nAngleX ( ), 0, 0, object.kLocalSpace )
Any help?
- Kaldrick
- Fresh Boarder

- Posts: 6
Re: Moving camera
by RedQueen » 20 Oct 2011, 22:49
You can just parent the camera to the character. That is the simplest way. That way it will move where ever the character does.
- RedQueen
- Platinum Boarder

- Posts: 331
Re: Moving camera
by RedQueen » 21 Oct 2011, 13:39
Documentation is here as to how to setup parent->
http://www.stonetrip.com/developer/doc/api/object-setParent
http://www.stonetrip.com/developer/doc/api/object-setParent
- RedQueen
- Platinum Boarder

- Posts: 331
4 posts
• Page 1 of 1