≡
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: "Internation?l"
(you are not logged in)
Text:
[quote][b][/b] wrote: New information: I was using all of the code from the CCB file shared by [b]3dblendsphinx[/b] in my game, but I just realized that only this part is needed to fix the problem for Left and Right rotations: [code]if(ccbGetCopperCubeVariable("RotateRight")==1) { player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTurn=new vector3d(0,1,0); newPos=curRot.substract(vecTurn); ccbSetSceneNodeProperty(player,"Rotation", newPos); }else if (ccbGetCopperCubeVariable("RotateLeft")==1) { player=ccbGetSceneNodeFromName("Player"); curRot=ccbGetSceneNodeProperty(player,"Rotation"); vecTurn=new vector3d(0,1,0); newPos=curRot.add(vecTurn); ccbSetSceneNodeProperty(player,"Rotation", newPos); }[/code] My game wasn't even using the math part that I included in my first post. Please ignore the code for now and read the part below. I just need to know why each of the three parameters for rotations don't consistently affect the same axis! Please try this so you can understand what my problem is: [b]1.[/b] Open CopperCube and press "File", then press "New". Then press "New 3D App" and press "Ok". [b]2.[/b] Delete the sample object called "cubeMesh1" [b]3.[/b] In the "Scene Editing" tab, click the shape of a Cone. [b]4.[/b] A box will open that says "Create a cone". Press "Ok". [b]5.[/b] In the SceneGraph Explorer, click the object called "coneMesh1". [b]6.[/b] In its attribute box, change the rotation to [b]0, 0, -90[/b]. [b]7.[/b] That will be the rotation of my character during its normal movement. [b]8.[/b] If you want to know how I want it to turn when it looks upward, change the rotation to [b]0, 0, -45[/b], and then to [b]0, 0, 0[/b]. [b]9.[/b] Now, please set the rotation back to [b]0, 0, -90[/b]. [b]10.[/b] Now that you are at the default rotation of my character, change the rotation to [b]-90, 0, -90[/b]. [b]11.[/b] Imagine that position as showing how my character looks when it turns to look toward its right. [b]12.[/b] Now, imagine that my character rotates toward its right, and then imagine that I also want it to look upward again. Do you remember what we did to make my character look upward? We changed the Z rotation. We changed it from [b]0, 0, -90[/b] to [b]0, 0, 0[/b]! The Z rotation changed from a [b]-90[/b] to a [b]0[/b]! So, now, my character is looking toward its right, and I want it to look upward again, so my normal mind believes I should change the Z rotation from [b]-90[/b] to [b]0[/b] again, because that's what I did last time! Since the current rotation is [b]-90, 0, -90[/b], please change it to [b]-90, 0, 0[/b]. [b]13.[/b] Look at the result! The character doesn't look upward! The Z rotation parameter previously had the power to control the vertical rotation of my character, but it lost that ability! After it rotated to look toward its right, it lost the power to look upward by changing its Z parameter! Do you want to know how to make the character look upward now? I'll tell you, because it's disgusting! To force the character to look upward, we must change the [b]Y parameter[/b] of its rotation! Its Y paramter must change from [b]0[/b] to [b]90[/b], so the new rotation becomes [b]-90, 90, -90[/b]! Do you understand what my problem is now? Why did the parameter that can change the vertical rotation of my character switch from [b]Z[/b] to [b]Y[/b]? What should I do to be able to change the vertical rotation of my character at any time, regardless of its horizontal rotation? How do I disconnect them? I need a stable value that can be used to rotate my character upward or downward without being affected by its horizontal rotation![/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