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 / Is it possible?

Author
Message
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 02:57
I almost have jumping working for dynamic objects with dark physics, but I need to know if it's possible to assign groups, for example something like this (I wrote off of the top of my head):


Which would position all 3 objects in one command, is anything like that possible?

I want coke, not Pepsi!
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 3rd Oct 2010 04:14
nope, you could do

for( int i=1; i<4; i++)
{
dbPositionObject(i, 0, 0, 0);
}
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 04:20 Edited at: 3rd Oct 2010 04:34
THANK YOU, that was another thing I NEEDED to know!!
but I have one error, it says the variable coly is undefined.


I want coke, not Pepsi!
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 3rd Oct 2010 06:58
I only have a moment, but the first thing that came to mind was assigning a Group ID variable some how. Not sure exactly what your doing with these objects so I can not say exactly how to go about it. Though if you have some sort of Group ID assigned to all your objects then you could make a simple function with a for loop in it which you would call with your Group ID and it would go through all your objects group numbers and only the ones that match the ID you specified would be affected by the function.

example:



You could call this easily with Position_Group(1, 10, 5, 15); and would position all your objects with a Group ID of 1 to x:10 y:5: z:15. You could also change the function to move relative to the position of the object to be moved meaning that if all the objects are next to each other and want them to keep that formation you could just change the dbPositionObject() command to take into acount the current location of that particular object and move it by the number sent to the X, Y, Z variables.


As to the coly variable error, It may have to do with the fact that you keep trying to declare the same variable 4 times which will give an error. try declaring right befor the for loop. A better solution though would be an array for your physics collison something as simple as float coly[4]. The way you currently have it you'll only get the very last one because you only have one variable to store the information.

Well i'm just about out of time. I hope I explained everything enough, if not I can help more later on. Good Luck.

CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 08:35 Edited at: 3rd Oct 2010 08:37
this is what I tried:


and it didn't work
I am pretty much trying to use it for checking an object over and over (say object 2-5) for collision, it's much easier than writing out the code for each object.

I want coke, not Pepsi!
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 3rd Oct 2010 09:55
Ok, I have better idea what your doing now that i've seen your code. I don't use Dark Physics so I may not be able to answer everything completly, but I have a good idea what is going on.

First thing I noticed was your collison check is outside the main loop so your only going to get a collison between objects based on where you initially setup everything. you need to add it to the main loop.

Second thing is you need to record each object that your checking collisons for. Like I said in the previous post your trying to declare it multiple times and even having declared it only once your only going to get the very last check on the for loop. You can use only one boolean variable for this or you can use an array and store each objects collison status in it. My idea for this is to use a boolean variable for this collison. If any of them are colliding it will set it to 1/True then in your check to jump if it equals 1/True then you know its colliding with something.

example:


I think that is what your going for. Another thing to note is with your player position variables your declaring them each loop as well, you may want to declare them outside the main loop and just assign the values to them in the main loop.

CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 10:29 Edited at: 3rd Oct 2010 10:34
I just found a HUGE hole in my plan... this way would enable wall jumping, roof jumping, etc..
nevermind this, I will try another way...

I want coke, not Pepsi!
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 3rd Oct 2010 11:25
Sparky's dll is alot easier
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 18:25
Quote: " Sparky's dll is alot easier "

I already bought dark physics I want to use it.

I want coke, not Pepsi!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 3rd Oct 2010 18:37 Edited at: 3rd Oct 2010 18:38
havn't read your code, but a very obvious error:



you defined coly in the for loop's local scope, and thus it can't be used outside it, plus, everytime the loop loops, coly is re-created, you should define it in a viewable scope for the place you want to use it from (in your case, either make it global or define it somewhere inside DarkGDK function outside any loops/ifs/etc (scopes {})

Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 3rd Oct 2010 18:46
Well it is not that big of a hole in your plan. Instead of using the boolean to make the check for collision use an array. That way you can know the specific object being collided with and handle appropriatly. This is actually where assigning group id's would be a good idea. You could set all ground segments(or whatever) to a group id and then check your jumps off of them.

CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 3rd Oct 2010 19:54 Edited at: 3rd Oct 2010 20:29
Hey, im using raycasts now but I have a problem, see i'm trying to say if coly is above 5 but lower than 25 then...

whats wrong?

I want coke, not Pepsi!
Fatal Berserker
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 4th Oct 2010 00:40 Edited at: 4th Oct 2010 00:41
if the if statement or for (or while or function or whatever) only takes up 1 command, you do not need the {} btw.

eg


or


Should work just as well.

To answer your question:



Smoke me a kipper, ill be back for breakfast.
CocaCola
14
Years of Service
User Offline
Joined: 23rd Mar 2010
Location: CocaCola.x CocaCola.y CocaCola.z
Posted: 4th Oct 2010 00:59
Thank you so much I have it working now, should I put a tutorial on the dark physics section?

I want coke, not Pepsi!

Login to post a reply

Server time is: 2024-11-19 18:38:31
Your offset time is: 2024-11-19 18:38:31