RedWorld fundamental object in the RedUniverse toolkit
base for all other worlds like RedWorld1, RedWorld2, RedWorld3. implements simplified physical laws.
see also [RedObject], [RedUniverse]
class methods:
*new(dim, gravity, maxVel, damping)
create a new world. see class source for defaults.
instance methods:
add(redObj)
manually add an object to this world. usually never needed.
remove(redObj)
manually remove an object from this world.
contain(redObj)
wrap an object around world dimensions. ie world without borders - going out on the right side
brings the object back on the left.
contains(redObj)
check if an object is within world dimensions. used for detecting wall bounce. returns boolean.
instance variables:
<>dim
size of this world (RedVector of any dimension). ie the world can have any number of dimensions.
<>gravity
world gravity (RedVector of any dimension) for each dimension.
<>maxVel
scalar with maximum velocity. ie 'speed of light' for this world.
<>damping
scalar. the cost of running into walls etc.
<>objects
array of all objects currently in this world.
a= RedWorld.new
b= RedObject(a)
a.dump
RedUniverse.worlds
RedUniverse.remove(a)
RedUniverse.worlds