AngleToVector(float)
角度をベクトルに変換する。
vector AngleToVector( float fAngle );
Parameters
fAngle
ベクトルに変換する角度
Description
fAngleの値をベクトルに変換して返す。
Version
1.30
Example
// ストーカースクリプト(NPCのOnHeartbeatスクリプト) // 提供:Cheiron氏 void main() { object oTarget = GetNearestCreature( CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC ); ClearAllActions(); object oArea = GetArea(oTarget); vector vPosition = GetPosition(oTarget); float fOrientation = GetFacing(oTarget); // AngleToVectorの能力の発揮しどころ。 vector vNewPos = AngleToVector(fOrientation); float vX = vPosition.x - vNewPos.x; float vY = vPosition.y - vNewPos.y; float vZ = vPosition.z; vNewPos = Vector(vX, vY, vZ); ActionMoveToLocation( Location(oArea, vNewPos, fOrientation) ); // PCについていく (PCがそこにいるなら) ActionDoCommand(SetFacing(fOrientation)); // PCに向く }
See Also
functions: | Vector | VectorToAngle |
categories: | Type Casting/Conversion Functions |
author: Charles Feduke, editor: Lilac Soul, additional contributor(s): Cheiron, Lilac Soul, JP team: geshi, ngtaicho
Send comments on this topic.