Presentation is loading. Please wait.

Presentation is loading. Please wait.

UFCEKU-20-3Web Games Programming Creating Object Hierarchies.

Similar presentations


Presentation on theme: "UFCEKU-20-3Web Games Programming Creating Object Hierarchies."— Presentation transcript:

1 UFCEKU-20-3Web Games Programming Creating Object Hierarchies

2 UFCEKU-20-3Web Games Programming Agenda Object hierarchies in Shockwave Queuing and Simple parenting of objects

3 UFCEKU-20-3Web Games Programming Object Hierarchy Sun Earth Moon Sun - Earth - Moon system is classic example of object hierarchy in terms of local and relative orbit motion

4 UFCEKU-20-3Web Games Programming Basic Parenting of Objects Sun (parent) Earth (child of Sun) Moon (child of Earth)

5 UFCEKU-20-3Web Games Programming Basic Parenting of Objects carBox Left spotlightRight spotlight Need code to make the spotlights the children of the carBox (parent)

6 UFCEKU-20-3Web Games Programming member("world").model("carBox").addChild(member("world").light("leftSpotLight") ) Name in cast of 3dworld model in world addChild world name in cast object to add as a child Parenting syntax references models in the cast

7 UFCEKU-20-3Web Games Programming -- create two spot lights gameWorld.newlight("leftSpotLight", #spot) gameWorld.light("leftSpotLight").attenuation = vector(1, 0,0) gameWorld.light("leftSpotLight").spotAngle = 40.0 gameWorld.light("leftSpotLight").rotate(0,0,0) gameWorld.light("leftSpotLight").translate(-5,20,10) gameWorld.newlight("rightSpotLight", #spot) gameWorld.light("rightSpotLight").attenuation = vector(1, 0,0) gameWorld.light("rightSpotLight").spotAngle = 40.0 gameWorld.light("rightSpotLight").rotate(0,0,0) gameWorld.light("rightSpotLight").translate(5,20,10) -- make the spotlights the child of the carBox object member("world").model("carBox").addChild(member("world").light("leftSpotLight")) member("world").model("carBox").addChild(member("world").light("rightSpotLight")) -- now the lights (children) move around with the carBox object (parent) Basic Parenting of Objects

8 UFCEKU-20-3Web Games Programming Also Parent Cameras To create a first-person view from a vehicle - parent the appropriate camera to the vehicle


Download ppt "UFCEKU-20-3Web Games Programming Creating Object Hierarchies."

Similar presentations


Ads by Google