Page 1 of 1

Create a cylinder around a model

Posted: Fri Jun 21, 2013 11:52 pm
by Menyueru
Probably someone has asked this before but I've haven't found anyways to do this, basically i have a model i want to load, how is the best way to create the cylinder that will be around him to handle the collisions, I thought, i could get the model height, and width and get it from there but i don't know how to do that neither, could u guys help me with that?

Thanks in advance.

Re: Create a cylinder around a model

Posted: Sat Jun 22, 2013 1:11 am
by Norbo
One option would be to choose a particular point as the base of cylinder, somewhere around the feet. Then, iterate through all vertices in the model, subtracting them from your chosen base. The height of the model is then the highest Y offset, and the radius is the greatest horizontal offset length.

Re: Create a cylinder around a model

Posted: Sat Jun 22, 2013 3:29 pm
by Menyueru
Thanks norbo it worked :D you're the best!!!

Also, how can i know I'm colliding with a support??

Re: Create a cylinder around a model

Posted: Sat Jun 22, 2013 5:48 pm
by Norbo
Assuming you're using the CharacterController, check the CharacterController.SupportFinder.HasSupport property.

Re: Create a cylinder around a model

Posted: Sun Jun 23, 2013 2:32 am
by Menyueru
I'm not using the characther controller because i've had some problems porting it to what i need so i'm doing my own simpler one, but just checked what you did to do that i'll probably take the basic concept but thanks Norbo great job loving all your work so far :D