Castle Game Engine: CastleItems: Class TItemOnWorld

# Class TItemOnWorld
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleItems ## Declaration `type TItemOnWorld = class(T3DOrient)` ## Description Item that is placed on a 3D world, ready to be picked up. It's not in anyone's inventory. ## Hierarchy TComponent T3D T3DList T3DCustomTransform T3DOrient TItemOnWorld ## Overview ### Fields
| `RotationSpeed: Single; static;`
| `AutoPick: boolean; static;`
| `internal const DefaultRotationSpeed = Pi;`
### Methods
| `function GetChild: T3D; override;`
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `function GetExists: boolean; override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `function ExtractItem: TInventoryItem;`
### Properties
| `property Item: TInventoryItem read FItem;`
| `property Collides default false;`
| `property CollidesWithMoving default true;`
## Description ### Fields
| `RotationSpeed: Single; static;`
Speed of the rotation of 3D item on world. In radians per second, default is DefaultRotationSpeed. Set to zero to disable rotation.
| `AutoPick: boolean; static;`
Does the player automatically picks up items by walking over them. Default is `True`. If you set this to `False`, you most probably want to implement some other way of picking up items, use the ExtractItem method. More precisely, this variable controls when TInventoryItem.Picked is called. When `True`, it is called for player when player steps over an item (otherwise it's never called). You can always override TInventoryItem.Picked for particular items to customize what happens at "pick" — the default implementation picks an item by adding it to inventory, but you could override it e.g. to consume some potions immediately on pickup.
| `internal const DefaultRotationSpeed = Pi;`
### Methods
| `function GetChild: T3D; override;`
| `constructor Create(AOwner: TComponent); override;`
| `destructor Destroy; override;`
| `function GetExists: boolean; override;`
| `procedure Render(const Frustum: TFrustum; const Params: TRenderParams); override;`
Render the item, on current Position with current rotation etc. Current matrix should be modelview, this pushes/pops matrix state (so it 1. needs one place on matrix stack, 2. doesn't modify current matrix). Pass current viewing Frustum to allow optimizing this (when item for sure is not within Frustum, we don't have to push it to OpenGL).
| `procedure Update(const SecondsPassed: Single; var RemoveMe: TRemoveType); override;`
| `function ExtractItem: TInventoryItem;`
Extract the Item, used when picking up the TInventoryItem instance referenced by this TItemOnWorld instance. This returns our Item property, and clears it (clearing also TInventoryItem.Owner3D). At the next Update, this TItemOnWorld instance will be freed and removed from 3D world. It's up to you what to do with resulting TInventoryItem instance. You can pick it up, by T3DAliveWithInventory.PickItem (for example player is an instance of T3DAliveWithInventory), or add it back to 3D world by TInventoryItem.PutOnWorld, or at least free it (or you'll get a memory leak).
### Properties
| `property Item: TInventoryItem read FItem;`
The Item owned by this TItemOnWorld instance. Never `Nil`.
| `property Collides default false;`
| `property CollidesWithMoving default true;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10