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.

Code Snippets / [DBP] - Game World Units Metric/Imperial Conversion

Author
Message
Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 1st Jul 2015 21:20
The following snippet establishes units as an abstract measurement of how large a singular instance of space is, inside of your game world. These units can then be converted to or from imperial measurements such as miles or feet; or metric measurements such as meters and centimeters. (spelled metres and centimetres respectively in UK English, abbreviated as 'm' and 'cm')

You must establish how large your game units are in correlation to the scale of surroundings in your world; to do so you must call the SetWorldScale function with how many meters your units represent; for example; 10 would mean that for every unit in your game, each unit represents 10m. If you specify 0.01, for each unit in your game, each unit would represent 1cm.


Use the functions prefixed with the preposition; 'To'; in order to convert FROM a metric or imperial measurement INTO your gaming units.

Use the functions prefixed with the preposition; 'In'; so that you may return a conversion FROM gaming units INTO metric or imperial measurements.

Sorry it this system does not support lightyears or nanometers; my apologise for any inconvenience this may cause!



Login to post a reply

Server time is: 2024-04-19 12:14:02
Your offset time is: 2024-04-19 12:14:02