Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by headkit · Apr 22, 2010 at 01:36 PM · rotationcardempty

card rotation :: Empty with two planes

hi folks!

just playing around with nice unity to get in touch and better knowing each other...

i want to create a dounble sides textured card and want to rotate it by click and tried the following - please tell me from which point on it could be done better - still here to learn from you!

  1. I took one Empty and two Planes as Children of the Empty. Then I added texture and turned one of the planes to face down.

  2. I added a script with a OnMouseDown-Function in it to at least print me into the debug log.

problem: nothing happens, when i click onto the card.

is this because its an empty?how could I do better?

thanx!

edit: here is the code. just starting to play around...

var rotateSpeed = 250.0; var rotating = false;

function Start(){}

function Update () { if(rotating){ rotateCard(); }

}

function OnMouseEnter() { Debug.Log(gameObject.name + " OnMouseOver"); renderer.material.color = Color.red; }

function OnMouseUp () { rotating = true; }

function rotateCard() { var theRotation = rotateSpeed * Time.deltaTime; //if(theRotation <= 0.5){ print(theRotation); transform.Rotate(0.0, 0.0, theRotation); //} }

Comment
Add comment · Show 2
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 e-bonneville · Apr 22, 2010 at 01:39 PM 0
Share

It would help us answer if we could see your script. Care to oblige?

avatar image headkit · Apr 22, 2010 at 02:52 PM 0
Share

added the code...

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by spinaljack · Apr 22, 2010 at 02:18 PM

Depending on how you implemented the mouse function you may need a collider on the cards but as elbon suggests you should edit some code into your question.

Comment
Add comment · Show 11 · 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 headkit · Apr 22, 2010 at 02:53 PM 0
Share

right. added the code. seems to need to add a colider, hm?

avatar image headkit · Apr 22, 2010 at 03:17 PM 0
Share

works with a box collider!

avatar image headkit · Apr 22, 2010 at 03:18 PM 0
Share

but how do i now rotate the plane children and not just the box collider?

avatar image spinaljack · Apr 22, 2010 at 03:21 PM 0
Share

the code should be in the parent object then when you rotate the transform all the children will rotate with it, unless it's a billboard or something...

avatar image headkit · Apr 23, 2010 at 07:40 AM 0
Share

the code is on the parent but nothing moves...

Show more comments

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

No one has followed this question yet.

Related Questions

Issue with rotating 3d text? 0 Answers

Seeing imprecise rotation value rotating around a root 1 Answer

Flip over an object (smooth transition) 3 Answers

puzzle with rotating statues 1 Answer

Is it possible to add a point to the score, everytime the Player rotates 180°? 2 Answers


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