happy new years unity community quick question i looked around first and did not find any info on this so i thought to ask here im trying to put a creature in my game with six legs and a spider like body its the free cave worm on the asset store i have it going and set up with AI but i ran into an issue the character controller collision capsule doesn’t fit I changed the radius and heights to fit good but its either too big so if i shoot the air next to it it will hit the enemy or too small and i cant hit most of the body parts so has anyone come across a better way to do a better character controller if i could add more then one capsule i would be able to do it but i cant or don’t know how anyone have any ideas I would be very appreciative.
UPDATE :
I have been playing around with it and i put colliders in the bones of the model so i can shoot each spot but i cant seem to figure out how to send the damage to my main body so i can kill it ive tried this
using UnityEngine;
using System.Collections;
public class BodyPartdamage : MonoBehaviour {
void Start () {
if(other.GetComponent<CharacterDamage>() != null){
other.GetComponent<CharacterDamage>().hitPoints -= damage;
}
}
void Update () {
}
}
something i tested out but doesn’t work im trying to get it to just send the damage to my main body when i shoot
Update : ive tried and failed again there has to be a simple way to do this this is what i tried this time but i cant figure out how to send the send the float damage with the message
using UnityEngine;
using System.Collections;
public class BodyPartdamage : MonoBehaviour {
public GameObject parent;
// Use this for initialization
void Start () {
}
public void ApplyDamage ( float damage, Vector3 attackDir, Vector3 attackerPos ){
if (parent != null)
{
parent.SendMessage("ApplyDamage");
}
}
}
Update :
I tried this too … i think i got closer but its giving me this error error CS1501: No overload for method ApplyDamage' takes
1’ arguments… i feel a little stupid at this point all i want is when my bullet hits the collider that is part of the bones to send rerout the message to my NPC’s Damage handler
using UnityEngine;
using System.Collections;
public class BodyPartdamage : MonoBehaviour {
public GameObject parent;
// Use this for initialization
void Start () {
}
public void ApplyDamage ( float damage, Vector3 attackDir, Vector3 attackerPos ){
if (parent != null)
{
parent.GetComponent<CharacterDamage>().ApplyDamage(damage);
}
}
}
this is what the weapon does when it hits an NPC layer
if(hit.collider.gameObject.GetComponent()){
hit.collider.gameObject.GetComponent().ApplyDamage(damage, direction, mainCamTransform.position);
but the collider im hitting doesent have the characterdamage script so i need it to reroute it to the game object that does using
public GameObject anyname;
to specified game object with the characterdamage script because it is the parent game object sorry for so much but im lost im not a good programmer (learning) so i realy cant see what im doing wrong