Hi friends,
The functions
function OnControllerColliderHit(hit: ControllerColliderHit)
function OnCollisionEnter(theCollision : Collision)
are not working.
Regards,
vanhouten777.
Hi friends,
The functions
function OnControllerColliderHit(hit: ControllerColliderHit)
function OnCollisionEnter(theCollision : Collision)
are not working.
Regards,
vanhouten777.
Post your whole script and it will make it easier for someone to help you. Also explain what you mean by not working (eg) what the errors are.
Do you ave a collider on your gameObject?
function OnCollisionEnter(theCollision : Collision)
{
VFVoxelInteractionGameObject=GameObject.Find(“Voxel Interaction”);
//if(theCollision.gameObject.tag==VFVoxelInteractionGameObject.tag)
//{
// Check if the collider we hit has a rigidbody
// Then apply the force
//var LeastDistance888 : float;
//LeastDistance888=777;
HasTheAntCollided888=true;
//var CurrentDistance : Vector3;
//var LeastDistantContactPoint888 : ContactPoint;
//var ThisAntCollisionComponent888 : Collision;
//ThisAntCollisionComponent888 = gameObject.GetComponent(Collision);
for (var contact : ContactPoint in theCollision.contacts)
{
CurrentDistance = contact.point - transform.position;
DotProductVect1=contact.normal;
DotProductVect2=PreviousFrameCurrentDirectionOfUp;
DotProduct();
if(DotProductOutput>=0.0)
{
if(CurrentDistance.magnitude<LeastDistance888)
{
LeastDistantContactPoint888 = contact;
LeastDistance888 = CurrentDistance.magnitude;
grounded=true;
CurrentDirectionOfUp = LeastDistantContactPoint888.normal;
}
}
Regards,
vanhouten777
In the class VFVoxelInteraction function start I have added the following line
void Start()
{
GameObject VoxelTerrainGameObject;
VoxelTerrainGameObject = GameObject.Find(“Realistic Ant Farm Voxel Terrain1”);
_terrain = VoxelTerrainGameObject.GetComponent();
It is compiling correctly.
Before the “Voxelform” directory was in the “Assets” directory and it was not compiling correctly, the I copied the “Voxelform” directory to “Standard Assets” directory and I renamed the cs extensions of the “Voxelform” directory in the “Assets” directory to something else, so that there won’t be double compilation. Now it is compiling correctly but the collsion detection is not working properly.
Regards,
vanhouten777.
In the function
void Start()
{
GameObject VoxelTerrainGameObject;
VoxelTerrainGameObject = GameObject.Find(“Realistic Ant Farm Voxel Terrain1”);
_terrain = VoxelTerrainGameObject.GetComponent();
//terrain.n
if (_terrain == null)
{
Debug.LogError(“VFVoxelInteraction Voxel Terrain property must be set.”);
return;
}
_materialPalette = _terrain._materialPalette;
// Used in an example demo, but not required.
_paletteObjects = GameObject.Find(“Palette Objects”);
var paletteObject0 = GameObject.Find(“Palette Object”);
if ((_paletteObjects != null) (paletteObject0 != null))
{
_materialObjects = new GameObject[_materialPalette._materials.Length];
for (int i = 0; i < materialObjects.Length; ++i)
{
materialObjects = (i == 0) ? paletteObject0 : (GameObject)Instantiate(paletteObject0);
materialObjects.renderer.material = materialPalette.materials*;
_materialObjects.transform.parent = paletteObjects.transform;*
materialObjects.transform.localPosition = new Vector3(i * .2f, -.5f, 1f);
float scale = 1f / (Mathf.Abs(materialObjects.transform.position.x * .25f) + .01f);
materialObjects*.transform.localScale = new Vector3(scale, scale, scale);*
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I added the lines
GameObject VoxelTerrainGameObject;
VoxelTerrainGameObject = GameObject.Find(“Realistic Ant Farm Voxel Terrain1”);
*terrain = VoxelTerrainGameObject.GetComponent(); *
it is compiling correctly , how do I make collision detection work correctly.
I am getting this error
Ignore collision failed. Both colliders need to be activated when calling this IgnoreCollision
UnityEngine.Physics:IgnoreCollision(Collider, Collider, Boolean)
AntWalkerScript:Start() (at Assets/Scripts/AntWalkerScript.js:4097)
How come, there is a check mark on the colliders which comes on when adding the collider component, what does it mean by activate the collider?
Should I add a collider to the voxel terrain game object, if so what type of collider?
Regards,
vanhouten777.
You can check the belwo thread for more details
You can check the belwo thread for more details
Sir,
I have Terrain collider added to the voxel terrain
Regards,
vanhouten777.