How To Make Homing Objects.: Difference between revisions
>Mindraker |
>Dreaddraco2 No edit summary |
||
Line 9: | Line 9: | ||
Example: | Example: | ||
<pre> | <pre> | ||
game.Workspace.Part.RocketPropulsion.Target = game.Workspace.dreaddraco2.Head | |||
</pre> | </pre> | ||
Line 17: | Line 17: | ||
Example: | Example: | ||
<pre> | <pre> | ||
game.Workspace.Part.RocketPropulsion:fire() | |||
</pre> | </pre> | ||
Line 26: | Line 26: | ||
:abort() | :abort() | ||
This, as its name suggests, aborts the RocketPropulsions mission to get to you, You could us this if your objects need fuel, and when the fuel is 0 they drop out of the sky. | This, as its name suggests, aborts the RocketPropulsions mission to get to you, You could us this if your objects need fuel, and when the fuel is 0 they drop out of the sky. | ||
==Connecting The Event=== | |||
You would need to do something like: | |||
<pre> | |||
function onTocuhed(hit) | |||
local a = hit.Parent.Humanoid | |||
if a ~= nil then | |||
local b = game.Lighting.Rocket | |||
b.Position = Vector3.new(0,200,0) -- drop out of sky | |||
b.Parent = game.Workspace | |||
b.RocketPropulsion.Target = hit | |||
wait(0.01) | |||
b.RocketPropulsion:fire() | |||
<pre> | |||
==See also== | ==See also== | ||
[[RBX.Lua.RocketPropulsion]] The RocketPropulsion object | [[RBX.Lua.RocketPropulsion]] The RocketPropulsion object</pre> |
Revision as of 06:33, 13 May 2008
How To Make Homing Objects
Rocket Propulsion And The Part
Create the RocketPropulsion and the part object. Alternatively, you could make a missle with rocketpropulsion without a target, and put it in Lighting, then clone the rocket.
Defining the target
This requires a script.
Example:
game.Workspace.Part.RocketPropulsion.Target = game.Workspace.dreaddraco2.Head
Firing The Part
This also requires a script, this will set off your part (If Unanchored) after The Target:
Example:
game.Workspace.Part.RocketPropulsion:fire()
Additional Features
The CartoonCharacter property sets whether your part should head Directly towards it, ignoring the point its facing, or whether it faces straight at you. 1 Would be always facing at you. 0.5 Would be sort of facing you. 0 would be No effort to facing you.
- abort()
This, as its name suggests, aborts the RocketPropulsions mission to get to you, You could us this if your objects need fuel, and when the fuel is 0 they drop out of the sky.
Connecting The Event=
You would need to do something like:
function onTocuhed(hit) local a = hit.Parent.Humanoid if a ~= nil then local b = game.Lighting.Rocket b.Position = Vector3.new(0,200,0) -- drop out of sky b.Parent = game.Workspace b.RocketPropulsion.Target = hit wait(0.01) b.RocketPropulsion:fire() <pre> ==See also== [[RBX.Lua.RocketPropulsion]] The RocketPropulsion object