Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / SC_SphereSlide problems with loaded models

Author
Message
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 11th Apr 2010 14:31 Edited at: 11th Apr 2010 14:57
Ok well we all know sparky's dll, so lets get to the point. The SC_SphereSlide command in my code (in the snippet below) allows nice sliding collision with objects such as cubes, but as soon as I use it on a loaded .x model the collision only occurs in the very center of the loaded object in a sphere with the given radius.



If you don't understand what I mean, here is a diagram.



EDIT: Ahh sorry I was wrong. The cube doesn't work either. Looking at the diagram though, the cube diagram is how the collision should work, and the loaded model diagram is what is happening.

EDIT2: It would seem that it doesn't like the "scale object" command. I use it before SC_SetupObject but if the object is scaled the collision won't work how it is meant to.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 11th Apr 2010 19:30
I've had issues with scaled objects too. Try doing things in this order:
1) Load the object (Load Object)
2) Set it up for collision (sc_SetupComplexObject)
3) Allow scaling (sc_allowobjectscaling)
4) Scale the object (Scale Object)
5) Update the object (sc_updateobject)

Anyway, there are a few other things in there that might be causing problems. First of all, there may be a variable name mixup. You load your house object like so:


But then you do collision with it like this:


The variable names are different! Try changing the objHouse in the second snippet to objHouse001.

When you use sc_setupcomplexobject, you should set the faces per node to 2. Also, it's always good to give objects you're going to be colliding with a group number (giving them no group has caused some problems for me in the past). So instead of this:



Try this (I'm using group 1):


Let me know how it goes. I hope this helps

<-- Spell based team dueling game!
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 12th Apr 2010 03:47
@Sixty Squares

Wow that's perfect. Thank you for the detailed and helpful response. Strangely enough, the variable name and the group number and 2 faces per node didn't change anything, but the first mention at the top did. Either way it's good to have those second changes in there and I will definitely keep that in mind.

Your help is greatly appreciated, so thanks again.

Login to post a reply

Server time is: 2024-11-23 16:57:05
Your offset time is: 2024-11-23 16:57:05