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.

Dark GDK / (Sparky's ) Collision problem - object falling down through terrain

Author
Message
curse
11
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 5th Feb 2013 18:09 Edited at: 6th Feb 2013 00:17
As I said in the subject, I have some problems in managing with collisions with the Sparky's ibrary.
Following the examples provided with the library I wrote a small application, but, unfortunately, I have two problems.
The first problem is that I can not handle properly the collision of an object, in fact, that, instead of following the terrain, flying through the map (as if he had not gravity). On the ground, however, do not collide, so collision run successfully.

Variables


This is the initialization of the terrain


This is the initialization of the object


This is the function that control the movement of the object (collisions and gravity)



The second problem, however, relates to another object falling through the ground, so the collision is not done correctly.

This is the function that control the movement of the second object (character played by by human)


Have you have any idea?
I simply took the source code of examples and adapted it to my little scenario.
In attachment I uploaded binaries of the two cases.

Thanks in advance for you replys (and sorry my bad english).

Attachments

Login to view attachments
_Pauli_
AGK Developer
14
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 6th Feb 2013 12:15
I didn't try your code or read too carefully, but I think this line could cause trouble when working with terrains:



If I remember correctly there is a terrain specific setup command in Sparky's Collision. Something like this:



But you would have to look into the documentation for that.

curse
11
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 6th Feb 2013 16:12
From what I read SC_SetupTerrainObject has been deprecated and instead SC_SetupComplexObject is used for the setup of terrain . This is also confirmed by the compiler; indeed if I try to put SC_SetupTerrainObject it tells me to replace it with other.
However, I have made ​​some progress, and the movement of the object controlled by the user (gravity and collisions work). I think that the problem was caused by initialization of the initial position of the object, which was a unit under the terrain level and so do not collide on the ground.
Unfortunately I have the same problem with the other object that continues to fly through the map and pass through the ground.

curse
11
Years of Service
User Offline
Joined: 5th Feb 2013
Location:
Posted: 11th Feb 2013 17:18 Edited at: 11th Feb 2013 19:59
I solved the previus problem in this way:

It's not the right ways (I wanted to use the cast collision), but for now it's okay.

I have another problem: I want to shoot bullets depending on where you point the mouse cursor, I implemented this solution but bullets does not move.
Any idea?


Thanks in advance for your answers.

EDI 1:
Some updates,
now the bullets move, but the collision with terrain sometimes it is not accurate and sometimes not collide.
I think that the problem it is the Z component of mouse cursor.






Login to post a reply

Server time is: 2024-04-26 03:31:18
Your offset time is: 2024-04-26 03:31:18