How to tell what surface is below
Blitz3D Forums/Blitz3D Programming/How to tell what surface is below
| ||
I am making a 3D racing game, and I would like to know how you guys tell what kind of surface/material is below the tires(tar, dirt, grass, mud, water, vaseline ;) ). I can pretty much assume that you perform a LinePick downwards from each tire, but then what do you do with that information? |
| ||
Get the texture of the mesh and use that (Blitz has built in get texture ability now). Or use names for the mesh below which are established in your editor. |
| ||
Do a LinePick down, then used PickedSurface. From this use GetSurfaceBrush and GetBrushTexture to determine the texture applied. |
| ||
Umm, I don't seem to have a GetSurfaceBrush command or a GetBrushTexture command. Did you mean something else? I have V1.87. [Edit]Upon furthur inspection, it appears that the commands are listed in the help file, but do not 'highlight' in the editor...[/Edit] |
| ||
Umm, I don't seem to have a GetSurfaceBrush command or a GetBrushTexture command http://www.blitzbasic.com/b3ddocs/command.php?name=GetBrushTexture&ref=3d_a-z http://www.blitzbasic.com/b3ddocs/command.php?name=GetSurfaceBrush&ref=3d_a-z |
| ||
What editor are you using? some IDEs require you add new commands to a "keywords" file. Visual Blitz has Keywords.INI i think.... |
| ||
Actually, they do highlight in the standard IDE. They just aren't being recognized in VisualBlitz. |
| ||
yeah i know they will highlight in the standard IDE... but as i said, SOME require adding things to the keyword file. thats why i asked what IDE he was using :P |
| ||
Yeah, that was the problem. Thanks for the help Cygnus. |
| ||
Here's my suggestion : 'Bake' your surface properties into your texture names. eg. tarmac_14_87.png could be a tarmac texture with a 'traction' of 14 and a 'max speed' of 87. Obviously the values and their uses are up to you. Or have a lookup array that returns your surface physics properties when it encounters certain names like 'tarmacfast.png' or 'grasswet.png'. I did a similar system to describe certain surface properties in LightBulb like alpha, fullbright etc. and it worked like a charm :) |