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.

DarkBASIC Professional Discussion / IAC - A new collision plugin

Author
Message
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 8th Feb 2006 18:54 Edited at: 15th Feb 2006 17:05
I've just finished the first version of my new collision plugin called IAC (Image All Collision ) and it doesn't cost anything except a place in the credits

It's a source file which you can include in your project to use the player movement and collision functions and not have to do any work for yourself

Function List:

SetUpFreeWorld(Filename$,Transparent,TransparentValue)
Filename$ - the file you want to open as your world
Transparent - 0=No Transparency, 1=Yes Transparency
TransparentValue - Integer, 1-4. Same as SET OBJECT TRANSPARENCY

SetUpFreePlayerObject(Load,Filename$,Primative$,Size#,XPos#,YPos#,ZPos#)
Load - 0=Don't load anything, 1=Yes load something
Filename$ - If you're loading something, this is the file
Primative$ - if you're not loading something, this is the object you make
Size# - This is the size of the primative
XPos# - Define the new Player object's X coord
YPos# - Define the new Player object's Y coord
ZPos# - Define the new Player object's Z coord

ControlPlayerObject(PlayerObject,Forward,Backward,Left,Right,Speed#,TurnLeft,TurnRight,Mouse)
PlayerObject - Object number of the player
Forward - Scancode of the key you press to move player forward
Backward - Another movement control key scancode
Left - Scancode of key pressed to strafe left
Right - Scancode of key pressed to strafe right
Speed# - How fast the player moves
TurnLeft - Scancode of key to turn left
TurnRight - Scancode of key to turn right
Mouse - 0=Just use the keys, 1=Use the mouse to turn instead

ControlPlayerCamera(Camera,Forward,Backward,Left,Right,Speed#,TurnLeft,TurnRight,Mouse)
Camera - Camera number of the player
Forward - Forward key scancode
Backward - Backward key scancode
Left - Strafe Left key scancode
Right - Strafe Right key scancode
Speed# - Overall speed of the player
TurnLeft - Left Turn key scancode
TurnRight - Right Turn key scancode
Mouse - 0=Use the keyboard, 1=Use the mouse to turn

PlayerObjectCollision(Camera,Player,World,PlayerHeight#,CameraHeight#,CameraDistance#,CameraSmoothRadius,CollisionRadius#,Gravity#,Sink#)
Camera - Camera number of camera folowing Player
Player - Object number of Player
World - Object number of World
PlayerHeight# - Distance between Player's Y Coord and the ground
CameraHeight# - Distance between Camera's Y Coord and that of Player
CameraDistance# - Distance the Camera should stay away from Player
CameraSmoothRadius - How smoothly the camera folows Player
CollisionRadius# - How far away walls can get to Player and Camera
Gravity# - Speed that Player should fall
Sink# - If your player object is floating above the ground, this is how much to push it back down

PlayerCameraCollision(Camera,World,CameraHeight#,CollisionRadius#,Gravity#)
Camera - Camera number of Player
World - Object number of World
CameraHeight# - How high the camera is off the ground
CollisionRadius# - How close walls can get to the camera
Gravity# - How fast the Camera should fall


The end!

FunkyStickmen: Battle of the Races (1%)

Attachments

Login to view attachments
Humanoid
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Finland
Posted: 8th Feb 2006 21:10
where is examples

Suomi Finland PERKELE!
<AMD athlon 64 3000+> <Asus A8N-E nForce4 ultra> <GF6600LE PCI-E> <1GB ram>
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 8th Feb 2006 22:10 Edited at: 9th Feb 2006 04:48
Here's an example of using it to make a sphere wander around on my terrain



And that's all you need to make the player walk around using the WASD keys and mouse

Edit: Ignore attachment, it's old

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 9th Feb 2006 04:12 Edited at: 9th Feb 2006 04:12
Update!

Added XYZ coords here
SetUpFreePlayerObject(Load,Filename$,Primative$,Size#,XPos#,YPos#,ZPos#)

Also, I gave the PlayerObjectCollision() command a much-needed checkup

Attachments

Login to view attachments
sadsack
20
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 9th Feb 2006 04:19
could not get it to compile.
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 9th Feb 2006 04:42
Could not figure out why. More info needed, sourcecode perhapse

Darth Vader
18
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th Feb 2006 08:18
Does it do matrix collision?

You Don't know the power of the Dark Side!!
Oh but I do!!
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 9th Feb 2006 15:30
Matrix collision?! Bah, who needs matrix collision? Just use the GET GROUND HEIGHT(MatrixNumber,XPosition,ZPosition) command.

Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 10th Feb 2006 17:34 Edited at: 10th Feb 2006 17:40
Okay...I fixed up the PlayerObjectCollision() command some more - now it works perfectly

Using just this code
I have made a ball walk on my terrain with the WASD keys and mouse. It also has gravity and goes down hills nicely. I've attached a ZIP file with the latest version of IAC, and the example program compiled with it (media compiled into .exe).

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 10th Feb 2006 17:43 Edited at: 10th Feb 2006 17:52
Sorry for the triple post, but the .ZIP I'm test-downloading doesn't want to extract, and I think it's cuz I edited my post and re-uploaded it... If it doesn't work in this post either I'll upload it in a self-extracting .EXE

EDIT: Nvm, I was forgetting to type a directory full location is C:\Program Files\Dark Basic Professional\Projects\ImageAllCollision\Examples\IAC_v1.2.1.zip

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 10th Feb 2006 17:56
AAAHHH!! Stupid post won't change the download zip! it's got an empty file in there and I can't change it!!

there...now it should download the correct file...

Attachments

Login to view attachments
Chris Franklin
18
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 10th Feb 2006 22:21
nice

Theme park simulator 5% Currently making menus
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 11th Feb 2006 00:11 Edited at: 11th Feb 2006 00:53
Did some tinkering to improve how the camera stayed above ground

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 11th Feb 2006 01:22 Edited at: 11th Feb 2006 01:23
Fixed up the FPS mode in it, so the PlayerCameraCollision() command works 100% now.

Example:

Notice how I did not use a SetUpFreePlayerObject() command. That's cuz there is no player object As far as I know, there's no CAMERA EXIST(Camera) command in DBP, so I cant do a SetUpFreePlayerCamera() command.

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 11th Feb 2006 08:18
New Function added

PerformPlayerAnimation(PlayerObject,Scancode,StartFrame,EndFrame)
PlayerObject - Number of your Player object
Scancode - Scancode of the key needed to play a specified animation with StartFrame and EndFrame
StartFrame - Which frame to start playing the object on. If this is 0, the object will start looping at frame 1.
EndFrame - When to go back to StartFrame. If this is 0, the object will loop to the end of the animation.

Attachments

Login to view attachments
Undercover Steve
18
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Vancouver, Little Canada(Washington)
Posted: 11th Feb 2006 17:34
quite amazing! Good job.

I have been re assigned. New name, new mission. Star Fleet - 5%
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 11th Feb 2006 21:18
Syntax Error! Here's the update...

FunkyStickmen: Battle of the Races (1%)

Attachments

Login to view attachments
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 14th Feb 2006 05:08
Update! Now it should work better with smaller-scale thingies.

FunkyStickmen: Battle of the Races (1%)

Attachments

Login to view attachments
Angel Lazerus
20
Years of Service
User Offline
Joined: 8th Feb 2004
Location:
Posted: 17th Feb 2006 22:25
This sounds cool.
I cant wait to play with it!

Angel. X



"Ill get a propper sig soon. LOL"
Jedi Lord
19
Years of Service
User Offline
Joined: 11th Jun 2004
Location: Jedi Temple
Posted: 18th Feb 2006 06:27
Here my PERFECT suggestion... just get ezrotation and NGC plugin they are 10x better than you can ever make. I hope I don't insult you. But it is the truth and the truth hurt.

Gnome that cast... AMAZING .
Torq
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location:
Posted: 18th Feb 2006 11:08
I have NGC also but the point is that Image all Has done this and offered it free! Which is a very nice and cool thing to do. Its always nice to have options.
Thanks Image ALL!

Whats the RED button for ?

http://badtempergames.tripod.com
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 18th Feb 2006 15:49 Edited at: 18th Feb 2006 15:50
If you don't want to use my plugin, then don't use it. But if I feel like making a plugin (which, fyi, I have deemed "For The Newbies") then that's my prerogative.

FunkyStickmen: Battle of the Races (1%)
Baggers
19
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 18th Feb 2006 16:32
Dont listen to tyler...no-one else does

steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 20th Feb 2006 18:10
image all, in the example of ur collision, what did u use to make ur terrain if ya dont mind.

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 20th Feb 2006 18:14
MilkShape3D and the "Terrain Generator" plugin

FunkyStickmen: Battle of the Races (1%)
steve c
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 20th Feb 2006 18:22
ah cool thanks.

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
NewDarken
18
Years of Service
User Offline
Joined: 12th Jan 2006
Location: Nevada
Posted: 23rd Feb 2006 04:18
Ive been messing around with my program for about a month, concentrating on models, animations, terrains and such, threw in a cheapo ground collision function just so I could test my animations and controls. I will say, this little function addin is def nice, the ball movement was 50 times better than mine. Thanks for the help and the effort. If I use any part of it, Ill def grant you credit! Thanks!


Side note....
TylerDX got Temp-banned for doing on other posts what he did here, thought some peeps might enjoy that fact, lol.

HTTP://www.hilbily-works.com
MECK WORLD
18
Years of Service
User Offline
Joined: 27th Jan 2006
Location:
Posted: 23rd Feb 2006 12:36 Edited at: 23rd Feb 2006 12:37
hello Image All,i study your "plugin" for about three days but i don't understand how x and z collision works...can you explain it please????and how can i use your plugin when i want to us it as a FPS?please answer....

The Power is in YOU!!!!!!!!!!!!!!!!!!!!!!
I KI TE BIV!!!!!!!
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 23rd Feb 2006 16:14
It shoots out little lines

I finally figured out that when the player turns, the direction of the front, left, back, and right rays should not. Therefor, when one of them hits a poly on the world object, I know which direction it is, relative to the player: +Z, -Z, +X, or -X. Therefor I can push the player out by as much as the ray is poking into the poly. I do this by dec Plrx#,Radius#-Right# saying that Radius# is the user-defined radius for collision and Right# is the length between the player and the poly. So if you subract the distance from player to poly from the overall length of the ray, you get pushed out by as much is necessary; no more no less.



If the ray is not hitting a poly, it returns 0. So if it is hitting a poly, then it returns a float value of the distance from the start of the ray to the poly, and then it is greater than 0, and I can do my stuff.

Quote: "and how can i use your plugin when i want to us it as a FPS?"


Example source code:


This assumes that the world and gun model are relatively small, though b][/b]P Use the function list at the top of the page to find which values you should enter to fit your needs.

FunkyStickmen: Battle of the Races (1%)
MECK WORLD
18
Years of Service
User Offline
Joined: 27th Jan 2006
Location:
Posted: 23rd Feb 2006 18:59
thanks...

The Power is in YOU!!!!!!!!!!!!!!!!!!!!!!
I KI TE BIV!!!!!!!
Hivernaal
18
Years of Service
User Offline
Joined: 22nd Jul 2005
Location:
Posted: 24th Feb 2006 10:17
Just fabulous

Thanks

2 reasons to live
f*** and kill
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 12th Apr 2006 08:24
Update!

There is a new variable for PlayerObjectCollision

PlayerObjectCollision(Camera,Player,World,PlayerHeight#,CameraHeight#,CameraDistance#,CameraSmoothRadius,CollisionRadius#,Gravity#,Sink#,DeadZone#)
DeadZone# - This is a float variable that will help define how steep a slope the player can go down without bumping down - NOT an angle; simply a float (e.g. 0.1)

FunkyStickmen: Battle of the Races (1%)

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-03 16:25:34
Your offset time is: 2024-05-03 16:25:34