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 / Cannot run Sparky's Collision!

Author
Message
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 5th Mar 2008 09:33
When I try to run an exemple I only get this errors:


What should I do?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th Mar 2008 19:36
I think in the PROJECT PROPERTIES, in the LINKER Section, I THINK in INPUT... there is a place where you can exclude libraries. I THINK you exclude the libcmt.lib (or just libcmt) or something.

I THINK therefore I AM....Not having great answer.

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 6th Mar 2008 09:02 Edited at: 6th Mar 2008 09:12
Okey, I get it. I copy the exemple code to a new project and I get some other errors, but the program runs anyway!

But can I make that the camera aviod walls with Sparky's collision?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 6th Mar 2008 20:48
yes... check out raycasting.

Another tip, I always make a new program with the DarkGDK "Wizard" template thingy so I don't need to fuss much with exclude this, include that.

I also put darkphysics, darkai, asn sparkys into the same directories (for respective file types) that darkgdk uses so it "Just Works" for the most part.

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 9th Mar 2008 21:02
Raycasting... Well, that sounds difficult. There is any exemple or tutorial for that?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 9th Mar 2008 21:09
Its actually easy, Sparky's comes with a tutorial for it... for DarkGDK too... just look in the directories you got with it.

Its actualyl easy. You SC_SetupObject(ObjID, Type_0_or_1_or_2); all your objects.

then You SC_RayCast(ObjectYouTryingToHitID, FromX, FromY, FromZ, ToX, ToY,ToZ);


That function returns... I think the distance it was from the FomX,FromY,FromZ to the hit.

I also personaly use the Sparky Groups, you can add a bunch of Objects SC_SetUpObject(ObjId, GroupNo, Type) or something like that, then SC_RayCastGroup(GroupNo, FromX, FromY, FromZ, ToX, ToY,ToZ); and that I THINK gives you either the OBJECTID or the distance of whatever thing you Smacked.

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 10th Mar 2008 16:42
I do not understand... What I should do when the RayCast function has detected an object? Here is a simple code, and I only want to make that the camera avoid the walls:

Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 10th Mar 2008 17:49 Edited at: 10th Mar 2008 17:51
if i recall the ray cast actually returns if a collision has happened not the distance ..



to find the object id that we hit use something along the lines of



you could then use a mixture of dbObjectPositionX(HitObject) and stuff to position the camera where you want it.

Stuck in the land of the confused! and loving it!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 10th Mar 2008 17:58
I think your right - especially with the group one. I was sure with raycast individual because I THOUGHT you pass the OBJ ID you're trying to hit. Though... Passing back ZERO or again that OBJECTID makes sense too

Fusspawn
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 10th Mar 2008 18:06
i cant comment on the single raycast as i only ever work with group raycasts and havent had a chance to use the single ones yet.

I also havent had my 50 billion cups of coffee yet so i could be totally wrong

Stuck in the land of the confused! and loving it!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Mar 2008 01:17
Ok Bro - I'm pressed for time - had to work late tonight - but here's the deal. you're TRYING to prevent the Camera from hitting walls.

the RayCast Tells you when you get a hit. There are other Sparky functions that tell you distance - I know this is true. so you could add things in a group you don't want to run int, or set up multiple groups and test each, and check distance.

Another way might actually be simpler than the ray cast.
(someone else mentioned this or another thread or this one...)

Anyway, you do you normal SC_SetUpObject( blah blah for all the objects you want collision detection or not.

Then you create a Sphere, or boax, the soize of which you envision your camera being inside of (the bounds box). You Set that object up in sparky's also. Now everywhere you move the camera, you position and move the cube... BUt BEFORE YOU MOVE IT.... You save the position and angles of where it is, then you move it, then you use SC_Obectcollision(blah blah) or whatever it is ... the one where you pass the object ID (in this case the Bounding box/sphere id) then the number returned is the ID of the thing you hit. We don't care in this case... we just care it is was hit or not.

If you get a hit, you position the BOX and angle it where it was just before you moved it to match the camera. then you move the camera to the same orientation as your bounding box.

Now the ID you got back from the collide is important only to reset the object you hit, I think you nmight need to reset your camera bounding box also... I think the command for these "resets" is SC_UpdateObject(id) or something

I hope this helps. Let us know hwo you make out.

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 11th Mar 2008 19:53 Edited at: 11th Mar 2008 20:02
I think I begin whith the distanse...
SC_getCollisionDistance(id) return somting, but where should I use the return value? In camera position X, Y or Z or maybe on all three like this:



I maybe also must use wrapwalue in this case, but anyway...

Noo, this code donĀ“t work!
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Mar 2008 20:00 Edited at: 11th Mar 2008 20:05
You posted you couldn't do it. you're best thinking so far got you here.

I Told you how to go about it....

You haven't tried what I said...

You're still stuck....

Who would have thought?

For You:
Quote: "Another way might actually be simpler than the ray cast."


Summary:
Quote: "If you get a hit, you position the BOX and angle it where it was just before you moved it to match the camera. then you move the camera to the same orientation as your bounding box.
"


No WrapValue, No distance required.... Now open up the Sparky Help, fire up your code editor, and take all I wrote... and turn it to code (with regards to my misspelling thingevery!)

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 11th Mar 2008 20:41 Edited at: 11th Mar 2008 20:46
Misspelling? xD I think you laugh every time you see what I wrote with my poor english!

Back to topic:

So I should not use Raycasting? Okey...

I did that you said, but the camera rotate away from the player...



I use the dbCollision instead for the SC_Collision, because the SC_Collision donĀ“t works.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 11th Mar 2008 21:41
This will get you started - its not CAMERA Collision, but sparky is working.

I did notice a glitch - but I think its because at certain angles the Eular reports 180degree opposite where you want to be - also I KNOW sometimes OBJECT's and CAMERA's don't report correct Angles intermittantly, and this can usually be squelched by rotating on a different axis than the one you just turned on.. like if turned left, look up, then down, maybe left then right.

Stupid I know - but its intermittant and might exmplain the ocassion "FLASH" where it seems like you did a 180 turn for ONE frame.

anyways...try this:


CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 12th Mar 2008 10:12
Should I make the camera in similar way like the player in your exemple?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th Mar 2008 12:15
What you're after has been done somewhat - but you'll find stuff more likely by combing the DBPRo stuff, code snips, tutorials etc.

To answer your latest post... the answer is.. "Sort Of"

You will have to add some smarts to it to go more left or more right or zoom out or zoom etc.. and I'll leave that you - but I did get you closer than you were

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 13th Mar 2008 20:21
But I can make the camera aviod the walls with the dbSetCameraToFollow function, but I don't know how I should use it.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 13th Mar 2008 21:51
Did my code at least help you with the sparky Part?

Camera to Follow I haven't messed with so can't help ya much there.

CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 16th Mar 2008 21:05
Yes, I think so.

Should I do a new topic about the camera avoiding?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th Mar 2008 21:24
I think so - Brilliant! (Getting to the bottom of this - one poly at a time! LOL )

Login to post a reply

Server time is: 2024-10-08 03:59:56
Your offset time is: 2024-10-08 03:59:56