How To Make Homing Objects.: Difference between revisions
>Nate m This is not an object either, it is a tutorial |
>Mindraker mNo edit summary |
||
Line 1: | Line 1: | ||
{{CatUp|Tutorials}} | |||
__TOC__ | |||
==Rocket Propulsion And The Part== | ==Rocket Propulsion And The Part== | ||
Create the RocketPropulsion and the [[Part|part]] object. Alternatively, you could make a missile with rocketpropulsion without a target, and put it in [[RBX.Lua.Lighting|Lighting]], then [[Clone|clone]] the rocket. | Create the RocketPropulsion and the [[RBX.Lua.Part (Object)|part]] object. Alternatively, you could make a missile with rocketpropulsion without a target, and put it in [[RBX.Lua.Lighting (Object)|Lighting]], then [[Clone (Function)|clone]] the rocket. | ||
==Defining the target== | ==Defining the target== | ||
This requires a [[Script|script]]. The script will define the target's [[Position|position]], the thing you want to home in on! | This requires a [[RBX.Lua.Script (Object)|script]]. The script will define the target's [[Position (Property)|position]], the thing you want to home in on! | ||
Example: | Example: | ||
Line 11: | Line 13: | ||
==Firing The Part== | ==Firing The Part== | ||
This also requires a [[RBX.Lua.Script|script]], this will set off your part (If Unanchored) after The Target: | This also requires a [[RBX.Lua.Script (Object)||script]], this will set off your part (If Unanchored) after The Target: | ||
Example: | Example: | ||
Line 55: | Line 57: | ||
==See also== | ==See also== | ||
*[[RBX.Lua.RocketPropulsion|Rocket Propulsion]] | *[[RBX.Lua.RocketPropulsion (Object)|Rocket Propulsion]] | ||
*[[Scripting]] | *[[Scripting]] | ||
[[Category:Scripting Tutorials]] | [[Category:Scripting Tutorials]] |
Revision as of 13:20, 22 August 2008
Rocket Propulsion And The Part
Create the RocketPropulsion and the part object. Alternatively, you could make a missile with rocketpropulsion without a target, and put it in Lighting, then clone the rocket.
Defining the target
This requires a script. The script will define the target's position, the thing you want to home in on!
Example:
game.Workspace.Part.RocketPropulsion.Target = game.Workspace.yourusernamehere.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 CartoonFactor 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 face you.
- abort()
This, as its name suggests, aborts the RocketPropulsion's 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 onTouched(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() end end script.Parent.Touched:connect(onTouched)
Using This Is Script Builder
This is what you might use in script builder:
a = Instance.new("RocketPropulsion") a.Target = game.Players.dreaddraco2.Character.Torso a.Parent = game.Players.Name.Character.Torso
This would make Name look like he's orbiting you.