Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Raycasts and CharacterColliders

Discussion in 'Multiplayer' started by luquitadenuevo, Apr 17, 2015.

  1. luquitadenuevo

    luquitadenuevo

    Joined:
    Apr 1, 2015
    Posts:
    8
    Hi,

    Sorry if it has been discussed haven't found it.
    And I know it's not specifically networking but there is more chance for people working in rewind and reply scenarios to run into this issue.
    Has anybody ran into issues with raycasts and character colliders?
    I have an instant projectile weapon and the AI on the past on the client, so when a shot is made by the auth owner he sends the time when the AI was shot. Server rewinds the AI (which is using a CharacterController as it cannot be done with rigidbodies) and raycasts against its collider (GetComponent<Collider> ()/*CharacterController*/.Raycast (/*burabura*/);
    Sometimes it hits, sometimes it doesn't. I'm DrawingRay everywhere and it seems like it should it, but it just doesn't.
    Does any of the CharacterController's parameters come into play here?
    (skinWidth, etc).

    Thanks,
     
  2. luquitadenuevo

    luquitadenuevo

    Joined:
    Apr 1, 2015
    Posts:
    8
    For anybody wondering, RayCasts do not work against CharacterColliders moved on the same frame.
    LineCast seems to do the trick though, although the hitInfo data is invalid (null collider and point far away).