≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
I used a script that fixes a problem related to horizontal rotations. Please modify it so it also works for vertical rotations!
Posted by:
(you are not logged in)
Enter the missing letter in: "Internat?onal"
(you are not logged in)
Text:
[quote][b]wild-master[/b] wrote: I found an answer to a previous problem here: [url]http://ambiera.com/forum.php?t=5479[/url] A high-class person named "[b]3dblendsphinx[/b]" shared a script that fixes it. (I used his second CCB file from that thread.) This is the previous problem: 1. The Left and Right buttons rotate my object. 2. When it rotated past 180 degrees, the directions of the Left and Right buttons were switched. The script from [b]3dblendsphinx[/b] fixes that problem. I want to modify it so it also works for vertical rotations, but my attempts have proven that I'm too inept to do that! This is the script: [code]if(ccbGetCopperCubeVariable("MovingForward")==1) { ///////////////////////////////// //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curPos=ccbGetSceneNodeProperty(player,"Position"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); //The Y axis will tell us what direction the player is facing playerDir=curRot.y; moveX=(Math.sin(playerDir*Math.PI/180))*2.6; moveZ=(Math.cos(playerDir*Math.PI/180))*2.6; vecMove=new vector3d(moveX,0,moveZ); newPos=curPos.substract(vecMove); //let's move the player ccbSetSceneNodeProperty(player,"Position",newPos); }else if(ccbGetCopperCubeVariable("MovingBack")==1) { ///////////////////////////////// //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curPos=ccbGetSceneNodeProperty(player,"Position"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); //The Y axis will tell us what direction the player is facing playerDir=curRot.y; moveX=(Math.sin(playerDir*Math.PI/180))*2.6; moveZ=(Math.cos(playerDir*Math.PI/180))*2.6; vecMove=new vector3d(moveX,0,moveZ); newPos=curPos.add(vecMove); //let's move the player ccbSetSceneNodeProperty(player,"Position",newPos); } if(ccbGetCopperCubeVariable("RotateRight")==1) { //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTurn=new vector3d(0,1,0); ////Let's turn Right newPos=curRot.substract(vecTurn); ccbSetSceneNodeProperty(player,"Rotation", newPos); }else if (ccbGetCopperCubeVariable("RotateLeft")==1) { //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTurn=new vector3d(0,1,0); ////Let's turn Left newPos=curRot.add(vecTurn); ccbSetSceneNodeProperty(player,"Rotation", newPos); }[/code] And this is the part I added to enable vertical rotations: [code]if(ccbGetCopperCubeVariable("TiltUp")==1) { //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTilt=new vector3d(0,0,1); ////The Player will be tilted upward NewRotation=curRot.substract(vecTilt); ccbSetSceneNodeProperty(player,"Rotation", NewRotation); }else if (ccbGetCopperCubeVariable("TiltDown")==1) { //Let's get the player reference and position and rotation player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTilt=new vector3d(0,0,1); ////The Player will be tilted downward NewRotation=curRot.add(vecTilt); ccbSetSceneNodeProperty(player,"Rotation", NewRotation); }[/code] (I must split this post because this forum claims to have a limit of [b]4,096[/b] characters for each post, but I posted this message with 4,096 characters and only the first 3,700 appeared, so the real limit is [b]3,700[/b].)[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact