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 planC · Mar 02, 2011 at 10:53 AM · fallingthroughfloor

zombies and the player SUDDENLY(not a beginning but a middle of playing) falling down

I'm developping a zombie game with networks. I was just killing zombies in the game, but suddenly zombies and the player start falling down through the terrain.

And when I was standing on a box, it happens again~ suddenly my character was falling down. It seems like physics does not work anymore.

I'm using unity steer, and angry behave for AI. Give me a hands plz~

ps: Thank you for your replying Bunny83

  • It is a 'normal' network game~
  • And I was just playing my self(just me), I saw that happening in my PC.
  • And Yes, when I was standing on a box suddenly falling down.
  • And the zombie and the player does not has a rigidbody.
  • And unity steer use a CharacterController.

Here is my zombie's source.

And the player's source is, I use BootCamp's soldier's script.

void Update() { if (!networkView.isMine) return;

 if (energy < 0)
     return;

 if (behaviorTree != null && 
     behaviorTree.Tick(this, null) != BehaveResult.Running)
     behaviorTree.Reset(this, null);

 Vector3 dir;
 if (zombiAni.IsFiring)
 {
     dir = new Vector3(finder.TargetDirection.x, 0, finder.TargetDirection.z);
     if (dir != Vector3.zero)
         transform.rotation = Quaternion.LookRotation(-dir);
 }
 else
 {
     dir = new Vector3(moveDirection.x, 0, moveDirection.z);
     if (Speed <= 0.1f)
         dir = new Vector3(finder.TargetDirection.x, 0, finder.TargetDirection.z);
     if (dir != Vector3.zero)
         transform.rotation = Quaternion.LookRotation(dir);

     if (zombiAni.IsWalking || 
         zombiAni.IsRunning)
     {
         UpdateDirection();
         UpdateMovement(false);
         RegenerateLocalSpace(moveDirection);
     }
     else
         UpdateMovement(true);

     if (dir != Vector3.zero)
         transform.rotation = Quaternion.LookRotation(-dir);
 }

}

private void UpdateDirection() { if (!finder.IsTargetFounded) return;

 if (MaxForce == 0 || MaxSpeed == 0 || Time.deltaTime == 0)
     return;

 Profiler.BeginSample("Calculating forces");
 Vector3 force = Vector3.zero;
 foreach (Steering steering in Steerings)
 {
     if (steering.enabled)
         force  += steering.WeighedForce;
 }
 Profiler.EndSample();

 Vector3 clippedForce = Vector3.ClampMagnitude(force, MaxForce);
 Vector3 newAcceleration = (clippedForce / Mass);
 if (newAcceleration.sqrMagnitude == 0 && !HasInertia)
 {
     Speed = 0;
 }

 Vector3 newVelocity = Velocity;
 smoothedAcceleration = OpenSteerUtility.blendIntoAccumulator(0.4f,
                             newAcceleration,
                             smoothedAcceleration);

 newVelocity += smoothedAcceleration * Time.deltaTime;
 newVelocity = Vector3.ClampMagnitude(newVelocity, MaxSpeed);

 Speed = newVelocity.magnitude;
 moveDirection = newVelocity;

}

private void UpdateMovement(bool isUpdateGravityOnly) { //Apply gravity if (isGrounded) upSpeed = 0; else upSpeed -= gravity * Time.deltaTime;

 Vector3 movement = new Vector3(0, upSpeed, 0);
 if (!isUpdateGravityOnly)
     movement += (moveDirection * Time.deltaTime);

 //Move controller
 CharacterController controller = GetComponent<CharacterController>();
 CollisionFlags flags = controller.Move(movement);
 isGrounded = (flags & CollisionFlags.CollidedBelow) != 0;

}

Comment
Add comment · Show 6
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 Bunny83 · Mar 02, 2011 at 11:20 AM 0
Share

Some code? Use edit! So it's a network game then a bit more detailed description would be great. How owns the playerobject? aka do you use an authoritative server setup or the "normal" one? Where do you see you're falling through something? On another client or on your own pc? Does it happen when you don't move? do you use any forces that are applied to your player? Some debugging info: Do the zombies/player still have a collider? I never used unity steer... does it use a CharacterController or a Rigidbody?

avatar image planC · Mar 02, 2011 at 12:17 PM 0
Share

Thank you Bunny83~ I append some code.

avatar image Bunny83 · Mar 02, 2011 at 12:41 PM 0
Share

Well, everything looks right to me not to say even perfect ;) Can't find a reason for such behaviour in that script. As long as you do not remove colliders by script (or changing them to isTrigger) it should work. Did I get that right, you are the server and play alone (like single player)? Do you use any special network code? NetworkViews that monitor the transform bypass the CharacterController.$$anonymous$$ove when they get updated. But if you're the owner of the NetworkViewID you shouldn't get any updates since you're sending them.

avatar image planC · Mar 02, 2011 at 04:31 PM 0
Share

Yes I was playing as server and alone.. and even if I disable networkview components of the zombie and the player. It is still happening lol.. :'(

avatar image planC · Mar 03, 2011 at 04:26 AM 0
Share

And there was no error and warning message in console

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Drakulix · Apr 03, 2011 at 12:42 PM

how come i can't use the soldier script when i make a new scene in the bootcamp project

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

Falling through the floor issue 11 Answers

Items falling through floor? 2 Answers

Falling Through My Elevator.. 3 Answers

Falling through world. 1 Answer

Terrain edit problem 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