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 N1nja · Jul 25, 2012 at 01:58 AM · physicsrigidbodycharactercontrollerexplosion

CharacterController and RigidBody

I have some gameobjects which have character controllers, basically I want to explode them, and shoot them up into the air.. typically i'd use rigidbody .AddForce and .AddTorque, these wont work however due to the attached CharacterController, so what i tried to do was detach that then do it, the problem is that when they gameobject is 'dead', it should become a trigger so that I may walk through it, so here is a series of events that must occure in some order to disable character controller, use rigid body for physics, when the enemy hits the ground, make static, turn off gravity(or just disable rigid-body completely) and set collider to trigger;

however its easier said then done, because when I try this, I run into issues such as, removing character controller, then trying to use the rigid body.. just barely has an effect, before ever having a character controller AddForce(0,10,0) worked fine, now after removing the charactercontroller it just barely nudges the object.. then of course there is no good quick way to disable the rigid body after he hits the ground, without some hard-coded script; all in all, the main issue where AddForce now hardly has any effect right after moving the charactercontroller(in the same frame) and im unsure if that has something to do with it.. I did notice that after the first frame, it suddenly works well enough

Comment
Add comment · Show 1
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 AlucardJay · Jul 25, 2012 at 04:35 AM 0
Share

Check out these scripts on UnifyCommunity :

http://unifycommunity.com/wiki/index.php?title=RigidbodyFPSWalker

http://unifycommunity.com/wiki/index.php?title=PhysicsFPSWalker

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Ingen · Jul 25, 2012 at 03:18 AM

switch your enemy with his fbx with a common rigidbody instead CharacterController, when hitted ,

maybe yield 0.5 second, then do what you need.

Can work?

Comment
Add comment · Show 3 · 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 GC1983 · Jul 25, 2012 at 03:46 AM 0
Share

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddExplosionForce.html

Try this. Attach this script to the object you want to be the collider. Whatever objects you want to be effected, just give them rigidbodies and colliders and watch them fly!

avatar image N1nja · Jul 25, 2012 at 05:49 AM 0
Share

well, i fixed the issue with collision on death, where I create a couple layers and set player and enemies to ignore dead layer, where upon death i set enemy to dead layer; and that works well,

the current problem is that i kill the enemy, which removes the character controller, and adds a rigidbody/collider, I already have been using the addexplosionforce, but the problem at the moment is that for some reason during that swap the enemy fell through the ground so I added a rigidbody.Sleep, and that stopped that issue, but that also effected the addexplosionforce, so i went ahead and added a lil more code to do that on the next frame, and still its not working, so now other then that its fine, but i would like to get that working, i really want them to "fly";

any suggestions? the yield thing wont work because I am not using behaviours to do this, am using the Update

avatar image Seth-Bergman · Jul 25, 2012 at 07:21 AM 0
Share

capture the transform.position before the swap, then reset it after :) in other words, just move him back above the floor to his original position

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

9 People are following this question.

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

Related Questions

Rigidbody.AddExplosionForce() Not Playing Nice With Trigger Colliders 1 Answer

Making a character controller work with physics 1 Answer

Parenting the Character Controller to rigidbody: won't stick 1 Answer

Touch input to move rigidbody using explosion force in C# 0 Answers

Earth quake with physics? 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