Collision from the underside of a cylinder (Unity C#)

A quick introduction to my problem at the moment: I am currently having trouble with checking whether or not a cylinder is grounded. I am using a mesh collider (octagonal prism) as my main collider for the object, however I can't seem to get a reliable ground detection beneath it. I have tried using a trigger and raycasting, but neither seem to work correctly.

It would be a great help if you could either provide a method of correctly raycasting the cylinders base, or an alternate method (bearing in mind the object rotates on all axis). Many thanks in advance. (terrible diagram below)

Collision from the underside of a cylinder (Unity C#)

Replay

Use a RigidBody SweepTest.

If your cylinder is not already a rigid body, make a duplicate of it for this test. Utilizing the rigidbody component on your object, call the sweep test to detect if moving the body down a very small amount hits ground.

It's essentially a raycast for each point in the rigidbody, as described in the description:

Tests if a rigidbody would collide with anything, if it was moved through the scene. This is similar to doing a Physics.Raycast for all points contained in any of a Rigidbody's colliders and returning the closest of all hits (if any) reported.

Category: unity Time: 2016-07-29 Views: 1

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.142 (s). 12 q(s)