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 / cant Get Sparks DLL to work in my program

Author
Message
Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 20th Nov 2011 23:11
Can't seem to get the collision routine in my program working properly. I drop the player from above onto the ground but the player sinks through the floor. I am using Sparks DLL which I have never used before. Can anyone please help me debug my code.




"There are no perfect ideas only perfect intentions"
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 21st Nov 2011 06:37 Edited at: 21st Nov 2011 18:35
I had to make a cylinder for your player since I don't have your media. 2.0 for a radius# is small, so I changed it to 8.0. It shows the wireframe of the collision sphere as well as the player in front of the camera. I didn't see why you needed a separate camera, so I deleted the playercam camera. Also, I change the player rotation, as TURN will cause the angles to weird out.

Also, you want gravity to take place after you have stored the player's coordinates in your collision check routine. As you can see, I moved your SimulatedGravity subroutine call into the playermove subroutine.

There is more to do here, but this should at least get you to where you have collision.




Attachments

Login to view attachments
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Nov 2011 10:44
Your problem is here:



You move the object up and down, and then you perform a collision check using the old positions. This will of course not result in a collision. Changing it to this should make it work:



TheComet

Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 21st Nov 2011 17:55
Thank you LBFN and TheComet for helping me with my code
the code that I posted earlier seems to now work with your help

However now I have a new problem.

When I substitute the flat plain with the terrain that I created the Collision system no longer works with it.

Any ideas why?

This time I have included the source and media in a zip file for you. Don't worry all of the media included this time is either royalty free or created by myself.



"There are no perfect ideas only perfect intentions"

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 21st Nov 2011 18:40 Edited at: 21st Nov 2011 19:47
First off, if you need to scale an object that is using Sparky's, you have to allow it, like this:



It is always a good idea to check and see what Sparky's sees as the object boundaries when you first load in an object to ensure it is correct. I set up the player object to sphere collision and using SC_DRAWOBJECTBOUNDS, it showed the bounding box. Here is a pic:




After using SC_ALLOWOBJECTSCALING (code listed above), it looked like this:




Also, you really don't need a collision sphere when you set up an object like this, so I would suggest eliminating that playercollisionsphere object altogether.

Here is a working version (albeit not perfect) of the game. You were moving the player downward with the camera at the end of the playermove subroutine. Also, you needed to allow scaling on the terrain object.



Hope this is helpful.


Attachments

Login to view attachments
Jonk
19
Years of Service
User Offline
Joined: 31st Jul 2005
Location: East of Java
Posted: 22nd Nov 2011 00:43
Thanks LBFN for your help, I at last have something that actualy works.

I know that it's not perfect but you have explained a great deal about using Sparky's and I will try to take it all in.

There is a problem with collisions with the tree meshes, but I already know that it is the large cross shaped planes that I used to act as a mesh to attach the tree textures onto.

Since this is only really a test terrain to try and work out the game engine I am not to bothered about this at the moment.

However do you know any way that I can Make the terrain texture less blurry though?

"There are no perfect ideas only perfect intentions"
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Nov 2011 01:14
You're welcome, glad to help.

Quote: "However do you know any way that I can Make the terrain texture less blurry though?"


I see you made it with T.ED, a program that I have heard about, but have never used. It seems you could adjust the settings to make it sharper, but I wouldn't know how to do that. Another thing you might try is to scale it up less. Note, that your initial placement of the player would change if you did that. For example, if you scaled the groundobject to 300,300,300, the player would need to be placed at
to work.


Login to post a reply

Server time is: 2024-11-25 16:09:24
Your offset time is: 2024-11-25 16:09:24