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 Josh Wilson · Feb 10, 2011 at 01:57 AM · rotationcollisioncollidereulerangles

Altered Collider parameters when Using Euler

alt text

var spark : GameObject;
private var counter=0;
private var grav = 0;
private var targetRotation : Quaternion;
function Start(){targetRotation=transform.rotation;}
function Update () {
if(grav!=counter){
targetRotation=Quaternion.Euler(targetRotation.eulerAngles.x,targetRotation.eulerAngles.y,targetRotation.eulerAngles.z-90);
//targetRotation *= Quaternion.Euler(0,0,-90);
grav=counter;
}
switch(counter){
case 1:camera.main.GetComponent(Data).GlobalGravity = Camera.main.transform.right;
break;
case 2:camera.main.GetComponent(Data).GlobalGravity = Camera.main.transform.up;
break;
case 3:camera.main.GetComponent(Data).GlobalGravity = Camera.main.transform.right*-1;
break;
default:
camera.main.GetComponent(Data).GlobalGravity = Camera.main.transform.up*-1;
}
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime*2); 
}
function OnCollisionEnter(collision : Collision){
    if(collision.collider.tag == "Projectile"){
    Instantiate(spark,collision.contacts[0].point,transform.rotation);
    //if(counter<3){
    counter++;
    }
    //}
}

Okay so the player shoots the arrow and changes gravity then rotates to point in the correct direction.Everything works fine except for the rotation part, which means I mark off the rotation code and shot it up and this glitch didn't happen. After two collisions the collider is set dramatically bigger to the side of the object.After 3 collisions the collider is stretched out diagonally across the whole stage(stupid invisible wall). I know it's the arrow collider because it's the only thing that makes sparks when you shoot it in the scene.When I pause the game to look at the collider it's a nice little capsule shape right where it should be. The arrow model(no collider) is a child of an empty game object with the collider component. The picture is a little misleading because the pivot point is in the center of the arrow instead of above it. I've use this code- targetRotation *= Quaternion.Euler(0,0,-90); , many times before with no problem, so please any help would be appreciated.

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 Josh Wilson · Feb 10, 2011 at 07:15 PM

Weird, found out that giving an empty gameobject a capsule collider then using Quaternion.Euler is a big No No. Maybe it warps the collider all out of whack because the Empty gameobject doesn't have a necessary component like a renderer to anchor the collider to even though it's a component to the Empty gameobject. My version of unity is a version behind however so maybe it's fixed in the newest version. Anyways got rid of the empty gameobject parent and now it work fine again. Still find it odd.

Comment
Add comment · 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

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

Reverse Rotation on mesh collision 1 Answer

Rigidbody doesn't rotate after collision 3 Answers

Character Controller falls through moving/rotating platforms (Not A Duplicate Post) 1 Answer

Odd collider rotation 1 Answer

Get angle from impact 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