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 / Tree Party and collision

Author
Message
action 9000
16
Years of Service
User Offline
Joined: 27th May 2008
Location: Alberta, Canada
Posted: 27th Aug 2009 07:44 Edited at: 27th Aug 2009 07:53
Hey!

I just picked up Tree Party today and while I'm able to get my trees to appear in DarkGDK, I'm having no success getting Sparky's or the DarkGDK collision systems to detect the tree as an object.

In the case of Sparky's, I get "Object (1) does not exist" when the line of code to set up the tree arrives.

In the case of DarkGDK's collision, absolutely nothing happens. No error, no collisions, no collison boxes, no nothing.

I am 11,500 lines of code into a project and I have functional collision (Sparky's) with the ground and water in my world. I just wanted to create another collision group for trees and let players smack into them.

I'll try to post my code but it's in functions all over the place...bear with me:

Basically, I start Sparky's collision engine way up in my code and have this little function to load and setup collision on my tree:


When it gets to

I get my error. I have declared the variable GVTree1 as in int prior.

According to the Tree Party documentation,
Quote: "
tpLoadtree(fname$) [The simplest way to load a tree is to use this command. It loads and creates a pre made tree from the MyTrees directory.]
This command you will use to load any trees you made from the editor, or to load trees included with the distribution. The tree must exist in the 'tpMedia/Mytrees' folder. This function will return a numerical ID number that you can use throughout your application to reference or make changes to the tree.
"


Is there any way to detect collisions with Tree Party trees or are they purely for decoration?
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 27th Aug 2009 11:44
You can, but you need to manually set it up. Each Tree Party Tree is made up of a number of GDK objects and meshes etc...

The easiest way to do it, is to use a "dummy" object for collision, make a box and hide it, that is the same dimensions as the tree, and use it as the collision object....

Or you could track your way through it's source, which isnt very complex, and add the appropriate bits and pieces in there..

If it ain't broke.... DONT FIX IT !!!
action 9000
16
Years of Service
User Offline
Joined: 27th May 2008
Location: Alberta, Canada
Posted: 27th Aug 2009 21:44
Aye, I suppose going in and trying to impliment collision in the actual Tree Party source is the best option. I was hoping there was a nicer way but it's all good. I'll try and work that out, thanks.
action 9000
16
Years of Service
User Offline
Joined: 27th May 2008
Location: Alberta, Canada
Posted: 9th Sep 2009 10:00
When attempting to impliment the code for collision, I am caught on a problem that I can't figure out the solution to. If anyone has any ideas, that would be awesome!

Anyway, here's what's happening:
I tried putting the following code into the Tree Party source


Right before the end of the Tree Party update() function. The idea is that if a new tree exists that doesn't have already collision set up on it, we set up collision and update the object if it is already set up.

Collision *detection* itself is working fine, but here's a screenshot of what's happening:


The collision box that is created is rotated 90 degrees away from where the tree is sitting! I did not call any rotate functions in my code; this seems to be the default behaviour.

I can't really cheat and create a dummy box over top of the tree because there will be flying creatures who will need to be able to land on / crash into branches with a reasonable degree of collision accuracy. I just can't reproduce this without being able to detect the tree itself.

Does anyone know why the collision box created is rotated 90 degrees away from the actual tree? Various attempts to rotate the tree also result in the collision box rotating the same direction, always giving me this 90 degree offset.

I have no idea how to fix this and any help is very much appreciated. Thanks a lot!
action 9000
16
Years of Service
User Offline
Joined: 27th May 2008
Location: Alberta, Canada
Posted: 18th Sep 2009 20:51
I don't suppose anyone has any ideas about this problem of the collision box not lining up with the actual object? If there are any resources or code I can include with my post to help out, I'd be glad to, I'm just completely unsure of why this is happening and it's of quite a bit of concern to the wellbeing of this project.
action 9000
16
Years of Service
User Offline
Joined: 27th May 2008
Location: Alberta, Canada
Posted: 20th Sep 2009 19:35 Edited at: 20th Sep 2009 19:37
Hey, I'm just posting back to say that I fixed this bug.

As for anyone curious what the solution was:

1) Load the tree

2) Write the setup collision code into the end of Tree Party's Update() function.


3) Delete the tree

4) reload the tree

then it works properly.

Login to post a reply

Server time is: 2024-11-20 15:25:57
Your offset time is: 2024-11-20 15:25:57