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 / Help needed on a 3rd Person camera with sliding collision

Author
Message
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 21st Jun 2005 01:11
The world will be a .x model. Previously I was using a fp view and looked through tutorials on sliding collision and got it to work using a camera. Anyway I don't know where to start could anyone give me some tips or help please. Any help would be great. Thanks
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 21st Jun 2005 02:30
I use nuclear glory DLL. sparky's dll is an alternative. Some use code in DB like kensupen's collision or others, search the codebase and code snippets

Check out the DB Freebie Archive: http://lysergium.net/dbfree/ thanks to DARKGuy
Want your game hosted free and a forum for feedback, or want media hosted? Click the email button below
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 21st Jun 2005 02:38
My probelm is that none of them(that I can find) use a moving x object as the main character, most use camera. I have tried to modify it to suit the object but have had no such luck. Do you have any code examples of this type of collision, or do you have any suggestions for the 3D camera. I think set camera to follow object will work but what distance should one have the camera from the object? Anyway thanks for your suggestion I will be ordering NG very shortly so that is probably the best way to go, just as a side note is it much easier to use ng than to code it in dbpro alone, and does it allow for .x objects, matrixs or both?
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 21st Jun 2005 03:20 Edited at: 21st Jun 2005 03:21
Although I have it, I have never got around to using nuclear glory so I cant advise there but for a third person, you need to have two sets of collision, one for the character and one for the camera, if the collision uses the camera position (in other words a math collision) then you just need to replace the camera position with the object position, both can use the code. For the movement of the camera however, theres several ways, easiest being SET CAMERA TO FOLLOW : SET CAMERA TO FOLLOW X, Y, Z, Angle, Distance, Height, Smooth, Collision


James

Hello!
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 21st Jun 2005 03:25
sorry i didnt see the "third person" in your title

nuclear glory uses object collision (ellipsoid to mesh or ellipsoid to ellipsoid collision, and there are more settings on the versions out now, i use an older version) so yes NGC can do what you want. once you get used to the functions, ngc is quite easy to use

what youd probably do is have two objects... your character as an ellipse, maybe 5 by 20 by 5 units, and a camera object (a sphere) as an ellipse, maybe 2 by 2 by 2 units. have both of these collide with the level(.x) as a mesh

you'll see how it works out when you get NGC. it comes with examples

Check out the DB Freebie Archive: http://lysergium.net/dbfree/ thanks to DARKGuy
Want your game hosted free and a forum for feedback, or want media hosted? Click the email button below
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 21st Jun 2005 03:38
Thanks qwe and James I'll give that a go.
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 21st Jun 2005 08:49
Sorry I dont have any code, or even placebo code, but I just thought I would mention about delays in your code (if this seems confusing, just ignore it!)
Collision can kill the screen fps, in my current project, I have used the technique of added Delays to the code in order to speed up the screen fps. In the project i turned it from 50fps to 300-900fps depending on what was happening, although I can not guarennty this will always help, its worth trying.

Pretty much, when you move an object, camera, check for collision - this is more than likely happening in EVERY loop. But if for example you were to add a set of delays, so for example the program only checks if the user wants to move the character every 10 loops, it wont create a sluggish looking movement but instead increase preformance.
Say for example you have a screen fps of 200, your program loops 200 times a second, if you were to check the movement every 10 loops, its still checking it 20 times a second which frees up the process which will in turn increase the FPS to about 300 which will lead to the program checking the movement about 30 times a second, which is totally unnoticable. Of course, this doesnt always work and you may just see an increase of say 5FPS, but every little helps.
What you do is for example change:

to

What this code does: It will look to see if MDelay = 0, if so it will check to see if you want to move the camera, despite the upkey being pressed, if MDelay does = 0 then MDelay will now = 10. It will then decrease MDelay by 1 every loop unless it = 0, in which case it will check once more if upkey$() is pressed.
Rather than having just one command, you can have several:

Now if your thinking, but I dont use move camera, or this post was about collision not movement. Well it doesnt matter, you can have ANY command in the delay and it will still have the same affect.
In otherwords, add the delay to a collision check, it will then only check the collision about every 10 loops, increaseing the FPS.

James


One last note I feel I should point out. I used a delay of 10 as an example. What I tend to do is experiment with the delay and create as big a delay as I can without having making the program look sluggish. That being said, different machines may generally produce a lower screen fps, in which case you would need a lower delay in order for your game not to look sluggish on there machine. Your best bet would be to add a delay that reduceds the screen FPS, but is way below what your PC can handle. (there are more complex ways of checking a delay but I wont go in to that for now)

Hello!
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 29th Jun 2005 19:15
Thanks James I haven't finished it yet but I'm getting there.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Jul 2005 02:58
You could check out my new collision program COLD, it works for .x objects as the character against .x objects as a map, you just have to get the limb positions right. For normal objects and cameras COLD works find with just dividing the width and height and length by two, but for .x objects you need the positions to be larger than the object's dimensions divided by two.

Here's the link: http://forum.thegamecreators.com/?m=forum_view&t=56416&b=8


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 1st Jul 2005 21:22
Thanks Ruccus I'll give it a go later on today looks really good; would you like some feed back on it or do you have enough already?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Jul 2005 23:17
The more feedback the better. The code doesnt work for cameras, Im working on that now.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection

Login to post a reply

Server time is: 2024-11-27 22:49:51
Your offset time is: 2024-11-27 22:49:51