Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PaxStyle · Feb 05, 2014 at 05:54 PM · rotation

Rotation Problem

Hi to all, i've created a script for rotating an object, but i don't understand why it dosn't work....

This is the script:

 using UnityEngine;
 using System.Collections;
 
 public class RideDampfkarussell : MonoBehaviour {
 
     GameObject teller;
     float teller_rot;
 
 
 void Awake()
 {
     teller = transform.Find("Corpo").gameObject;
     teller_rot = 0.0f;
 }
 
 void Start()
 {
 
 }
 
 void Update()
 {
     teller_rot = (teller_rot + Time.deltaTime * 30.0f) % 360.0f;
     teller.transform.localEulerAngles = new Vector3(0.0f, teller_rot, 0.0f);
 }
 
 }


hope you can help me, paolo

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Cataclysm Entertainment · Feb 05, 2014 at 06:27 PM

Hi, I have begun programming with unity for 3 years, so sorry if I will say, will be wrong. I think you have too complicated your script. If your rotation is like the earth rotation, you simply write that :

 var rotateSpeedX = 1.0f // or what do you want
 var rotateSpeedY = 1.0f // or what do you want
 var rotateSpeedZ = 1.0f // or what do you want again :)
 var rotatedGameObject  : GameObject;
 
 function Update ()  {
 
 rotatedGameObject.transform.Rotate(Vector3(rotateSpeedX,rotateSpeedY,rotateSpeedZ);
 
 
 }

You can, with this option, use all axis (x,y,z) to rotate your object in all possible rotations.

Good luck for programming. ;) May the Programmation be with you !

Sorry for my bad english, I'm french.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PaxStyle · Feb 05, 2014 at 09:00 PM 0
Share

Don't worry, i'm italian ;) I've begun last year, but i'm a disaster.. however, your script doesn't work.. i don't understand why..

 #pragma strict
  
 function Start () {
  
 var rotateSpeedX = 1.0f // or what do you want
 var rotateSpeedY = 1.0f // or what do you want
 var rotateSpeedZ = 1.0f // or what do you want again 
 var rotatedGameObject  : GameObject;
  
 } 
  
 function Update ()  {
  
 rotatedGameObject.transform.Rotate(Vector3(rotateSpeedX,rotateSpeedY,rotateSpeedZ));
  
 }
 }
avatar image Cataclysm Entertainment · Feb 06, 2014 at 12:30 PM 0
Share

Buongiorno,

For javascript, and I think it's the same thing in c#, you don't have to write the variables on the start function, you can write outside. Expect if you want to create variables for a specifical action.

For this code, if you attached this of the rotated gameObject, you can remove the lines number 8 and the first word of the line 14.

So you have a code like that :

 #pragma strict
  
 var rotateSpeedX = 1.0f // or what do you want
 var rotateSpeedY = 1.0f // or what do you want
 var rotateSpeedZ = 1.0f // or what do you want again 
  
 function Update ()  {
  
 transform.Rotate(Vector3(rotateSpeedX,rotateSpeedY,rotateSpeedZ));
  
 }


If my code is wrong again : you can watch the video of "Formation Facile" on youtube http://www.youtube.com/watch?v=O54abdJ4ezw&list=PL1CE0910DDEC1E411∈dex=5

it's in french, but i use his code for rotation.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Prefab Character position/rotation resets 0 Answers

Skateboarding Rotation Problem 1 Answer

Script Problem 1 Answer

Rotation in animation problem 0 Answers

Top Down 3D moves in unexpected ways. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges