Hi,
I’m new to Unity and right now I’m using a capsule with First Person Controller.
I put a foating block and my script detect when the player touch the side but not the top nor the bottom of the block.
This script is attached to the FPController (C#):
using UnityEngine;
using System.Collections;
public class BlockInteraction : MonoBehaviour {
public float pushPower = 2.0F;
void OnControllerColliderHit(ControllerColliderHit hit) {
Rigidbody body = hit.collider.attachedRigidbody;
if (body == null || body.isKinematic)
return;
if (hit.moveDirection.y < -0.3F)
return;
Debug.Log("Collided");
}
}
(Used from the docs on the Unity website);
FPControler Properties:
Transform > Scale: 1, 0.5, 1
Character Controller > Radius: 0.6
Character Controller > Height: 2
Graphics Properties:
Scale: 0.4, 0.5, 0.4
I’ve tried adding a sphere on the top of the character, tried to make the radius higher for the capsule (Someone on the internet suggested that it might resole the problem, with no success)
Any help is appreciate.