跳至正文
版本:最新版 - a1.142.x ⚖️

🛥️ VehicleWater

VehicleWater 是角色可以操控并驾驶在水面上行驶的实体,具有动态物理。


💂Authority
This class can only be spawned on 🟦 Server side.
🔁Network Authority Distribution
This class have the Network Authority distribution enabled and automatically handled by the server. You can override the Network Authority or disable it from automatically distributing.
👪Inheritance
This class shares methods and events from Base Entity, Base Actor, Base Paintable, Base Damageable, Base Vehicle.
🧑‍💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

🎒 示例

Server/Index.lua
Boat = VehicleWater.Inherit("Boat")
Boat.name = "Boat"
Boat.image = "assets://nanos-world/Thumbnails/SK_Motorboat.jpg"
Boat.category = "water"

function Boat:Constructor(location, rotation)
self.Super:Constructor(location or Vector(), rotation or Rotator(), "nanos-world::SK_Motorboat")

self:SetDoor(0, Vector(0, 0, 0), Vector(-120, 0, 55), Rotator(-10, 0, 0), 200, -100)
end

🛠 构造函数

Default Constructor

No description provided

local my_vehiclewater = VehicleWater(location, rotation, asset, collision_type?, gravity_enabled?, defer_spawn?)

Parameters

TypeNameDefaultDescription
Vectorlocation Required parameter No description provided
Rotatorrotation Required parameter No description provided
SkeletalMesh Referenceasset Required parameter No description provided
CollisionTypecollision_typeCollisionType.AutoNo description provided
booleangravity_enabledtrueNo description provided
booleandefer_spawnfalse传入 true 以避免立即将该实体发送给客户端,从而在你想要通过设置多个配置来调整它时提高性能。最后必须调用 FinishSpawn()
提示

Please take a look at our Default's Vehicle package with all built-in Vehicles already properly configured and ready to use.

🗿 静态函数

Inherited Entity Static Functions
VehicleWater inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
ReturnsNameDescription
table of Base EntityGetAll返回一个包含调用此方法的类中所有实体的表
Base EntityGetByIndex返回该类中指定索引处的特定实体
integerGetCount返回该类当前存在的实体数量
table of tableGetInheritedClasses获取使用 继承系统 创建的、直接继承自该类的所有子类列表
iteratorGetPairs返回一个包含该类所有实体的迭代器,用于 pairs() 循环
table or nilGetParentClass如果该类是使用 继承系统 创建的,则获取其父类
tableInherit使用 继承系统 继承此类
booleanIsChildOf如果该类是使用 继承系统 创建的,检查此类是否为另一个类的子类
functionSubscribe为该类的所有实体订阅一个 事件
functionSubscribeRemote订阅从服务器调用的自定义远程事件
Unsubscribe退订此包内该类中此 事件 的所有回调,或者仅取消传入的特定回调

This class doesn't have own static functions.

🦠 函数

Inherited Entity Functions
VehicleWater inherits from Base Entity Class, sharing it's methods and functions:
Base Entityscripting-reference/classes/base-classes/entity
ReturnsNameDescription
BroadcastRemoteEvent直接在此实体上向所有玩家调用自定义远程事件
BroadcastRemoteInRadiusEvent直接针对此实体调用自定义远程事件,并将该事件传递给半径范围内的所有玩家
CallRemoteEvent直接在此实体上向特定玩家调用自定义远程事件
CallRemoteEvent直接在此实体上调用自定义远程事件
CallRemotePlayersEvent直接在此实体上调用自定义远程事件,并将事件传递给玩家列表
Destroy销毁该实体
FinishSpawn完成生成过程,如果实体是通过 defer_spawn 生成的,则将实体发送给客户端
table of stringGetAllValuesKeys获取所有值键的列表
tableGetClass获取该实体的类
integerGetID获取该实体的全网通用网络 ID(在客户端和服务器上相同)
anyGetValue获取此实体上存储在给定键处的
booleanHasAuthority获取该实体是否由客户端生成
booleanIsA递归检查此实体是否继承自某个类
booleanIsBeingDestroyed如果该实体正在被销毁,则返回 true
booleanIsValid如果该实体有效(即未被销毁且指向一个有效的实体),则返回 true
SetValue在此实体中设置一个
functionSubscribe在这个特定实体上订阅一个事件
functionSubscribeRemote在这个特定实体上订阅一个从服务器调用的自定义远程事件
Unsubscribe退订此包内该实体中此 事件 的所有回调,或者仅取消传入的特定回调
Inherited Actor Functions
VehicleWater inherits from Base Actor Class, sharing it's methods and functions:
Base Actorscripting-reference/classes/base-classes/actor
ReturnsNameDescription
AddActorTag向该 Actor 添加一个虚幻 Actor 标签
AddAngularImpulse向该 Actor 添加角冲量。适用于单次瞬间爆发
AddImpulse向该 Actor 添加冲量。适用于单次瞬间爆发
booleanAttachTo将该 Actor 附加到任何其他 Actor 上,可选择附加在特定骨骼处
Detach将该 Actor 从其附加的 Actor 上分离
table of stringGetActorTags获取该 Actor 上的所有虚幻 Actor 标签
VectorGetAngularForce获取该 Actor 的角外力(由 SetAngularForce() 设置)
table of Base ActorGetAttachedEntities获取附加到该 Actor 的所有 Actor
Base Actor or nilGetAttachedTo获取该 Actor 所附加到的父级 Actor
tableGetBounds获取该 Actor 的边界范围
CollisionTypeGetCollision获取该 Actor 的碰撞类型
integerGetDimension获取该 Actor 的维度
floatGetDistanceFromCamera获取该 Actor 距离相机的距离
VectorGetForce获取该 Actor 的持续外力(由 SetForce() 设置)
VectorGetLocation获取该 Actor 在游戏世界中的位置
Player or nilGetNetworkAuthority获取该 Actor 的网络主控玩家
VectorGetRelativeLocation如果该 Actor 已附加,获取其相对位置
RotatorGetRelativeRotation如果该 Actor 已附加,获取其相对旋转
RotatorGetRotation获取该 Actor 在游戏世界中的角度值
VectorGetScale获取该 Actor 的缩放比例
floatGetScreenPercentage获取该 Actor 在屏幕中所占尺寸的百分比
tableGetSocketTransform在给定骨骼或插槽名称的情况下,获取世界空间中的插槽变换
VectorGetVelocity获取该 Actor 当前的速度
booleanHasNetworkAuthority如果本地玩家当前是该 Actor 的网络主控(Network Authority),则返回 true
booleanIsGravityEnabled如果该 Actor 启用了重力,则返回 true
booleanIsInWater如果该 Actor 处于水中,则返回 true
booleanIsNetworkDistributed如果该 Actor 当前处于网络分配状态,则返回 true
booleanIsVisible如果该 Actor 可见,则返回 true
RemoveActorTag从该 Actor 中移除一个虚幻 Actor 标签
RotateTo在一定时间内平滑旋转该 Actor 到指定角度
SetAngularForce向该 Actor 添加一个永久的角外力,设为 Vector(0, 0, 0) 可以取消
SetCastShadow设置该 Actor 是否投射阴影
SetCollision设置该 Actor 的碰撞类型
SetDimension设置该 Actor 的维度
SetForce向该 Actor 添加一个永久的外力,设为 Vector(0, 0, 0) 可以取消
SetGravityEnabled设置该 Actor 是否启用重力
SetHighlightEnabled设置该 Actor 是否启用高亮显示,以及使用哪个高亮索引值
SetLifeSpan设置该 Actor 被销毁前的生存时间(秒)。经过这段时间后,Actor 将被自动销毁。
SetLocation设置该 Actor 在游戏世界中的位置
SetNetworkAuthority设置某个玩家拥有此 Actor 的网络主控
SetNetworkAuthorityAutoDistributed设置该 Actor 是否在玩家之间自动分配网络主控
SetOutlineEnabled设置该 Actor 是否启用轮廓线描边,以及使用哪个轮廓线索引值
SetRelativeLocation在本地空间中设置该 Actor 的相对位置(仅在此 Actor 已附加时生效)
SetRelativeRotation在本地空间中设置该 Actor 的相对旋转(仅在此 Actor 已附加时生效)
SetRenderCullDistance设置该 Actor 的渲染剔除距离
SetRotation设置该 Actor 在游戏世界中的旋转
SetScale设置该 Actor 的缩放比例
SetVisibility设置该 Actor 是否可见
TranslateTo在一定时间内平滑地将该 Actor 移动到某个位置
booleanWasRecentlyRendered获取该 Actor 最近是否在屏幕上被渲染过
Inherited Paintable Functions
VehicleWater inherits from Base Paintable Class, sharing it's methods and functions:
Base Paintablescripting-reference/classes/base-classes/paintable
ReturnsNameDescription
ColorGetMaterialColorParameter从该 Actor 的材质中获取 Color 参数
floatGetMaterialScalarParameter从该 Actor 的材质中获取 Scalar 参数
stringGetMaterialTextureParameter从该 Actor 的材质中获取 Texture 参数
VectorGetMaterialVectorParameter从该 Actor 的材质中获取 Vector 参数
ResetMaterial将指定索引处的材质重置为原始材质
SetMaterial设置该 Actor 指定索引处的材质
SetMaterialColorParameter设置该 Actor 材质中的 Color 参数
SetMaterialFromCanvas将该 Actor 指定索引处的材质设为 Canvas 对象
SetMaterialFromSceneCapture将该 Actor 指定索引处的材质设为 SceneCapture 对象
SetMaterialFromWebUI将该 Actor 指定索引处的材质设为 WebUI 对象
SetMaterialScalarParameter设置该 Actor 材质中的 Scalar 参数
SetMaterialTextureParameter将该 Actor 材质中的纹理参数设为一张图像
SetMaterialVectorParameter设置该 Actor 材质中的 Vector 参数
SetPhysicalMaterial使用新的物理材质覆盖该 Actor 的物理材质
Inherited Damageable Functions
VehicleWater inherits from Base Damageable Class, sharing it's methods and functions:
Base Damageablescripting-reference/classes/base-classes/damageable
ReturnsNameDescription
integerApplyDamage对该实体造成伤害
floatGetDamageMultiplier获取特定骨骼的伤害系数
integerGetHealth获取当前生命值
integerGetMaxHealth获取最大生命值
booleanIsDead返回该实体是否已死亡
Respawn重生该实体,恢复其全额生命值并将其移动到初始位置
SetDamageMultiplier更改该实体在特定骨骼上受到的伤害大小
SetHealth设置该实体的生命值
SetMaxHealth设置该实体的最大生命值
Inherited Vehicle Functions
VehicleWater inherits from Base Vehicle Class, sharing it's methods and functions:
Base Vehiclescripting-reference/classes/base-classes/vehicle
ReturnsNameDescription
AddSkeletalMeshAttached附加一个骨骼网格体作为该实体的骨骼主姿态
AddStaticMeshAttached附加一个静态网格体到此实体
table of stringGetAllSkeletalMeshAttached获取附加到此实体的所有骨骼网格体
table of stringGetAllStaticMeshAttached获取附加到此实体的所有静态网格体
tableGetDoors获取所有配置的门
SkeletalMesh ReferenceGetMesh获取资产名称
CharacterGetPassenger获取指定座位上的乘客
table of CharacterGetPassengers获取所有乘客
PlayAnimation在此载具上播放动画
RemoveAllSkeletalMeshesAttached移除所有已附加的骨骼网格体
RemoveAllStaticMeshesAttached移除所有已附加的静态网格体
RemoveSkeletalMeshAttached根据自定义 ID 移除此可拾取物上已存在的骨骼网格体(如果存在)
RemoveStaticMeshAttached根据自定义 ID 移除此可拾取物上已存在的静态网格体(如果存在)
SetDoor为载具添加一个车门
SetExplosionSettings配置当生命值归零时的爆炸设置
SetStaticMeshAttachedTransform设置已附加静态网格体的位置和旋转
ReturnsNameDescription
SetEngineOffset设置引擎的相对位置(物理推进器、声音和特效的附加位置)
SetThrustStrength设置引擎/推进器的推力

SetEngineOffset

设置引擎的相对位置(物理推进器、声音和特效的附加位置)。默认值为 Vector(-200, 0, 0)
my_vehiclewater:SetEngineOffset(offset)

Parameters

TypeParameterDefaultDescription
Vectoroffset Required parameter No description provided

SetThrustStrength

设置引擎/推进器的推力。默认值为 1000
my_vehiclewater:SetThrustStrength(force)

Parameters

TypeParameterDefaultDescription
integerforce Required parameter No description provided

🚀 事件

Inherited Entity Events
VehicleWater inherits from Base Entity Class, sharing it's events:
Base Entityscripting-reference/classes/base-classes/entity
NameDescription
ClassRegister当使用 继承系统 注册一个新类时触发
Destroy当实体被销毁时触发
Spawn当实体被生成/创建时触发
ValueChange当实体通过 :SetValue() 改变了值时触发
Inherited Actor Events
VehicleWater inherits from Base Actor Class, sharing it's events:
Base Actorscripting-reference/classes/base-classes/actor
NameDescription
DimensionChange当 Actor 改变其维度时触发
Inherited Damageable Events
VehicleWater inherits from Base Damageable Class, sharing it's events:
Base Damageablescripting-reference/classes/base-classes/damageable
NameDescription
Death当实体死亡时
HealthChange当实体的生命值发生改变时,无论是由于受到伤害,还是通过脚本或重生进行手动设置
Respawn当实体重生时
TakeDamage当此实体受到伤害时触发
Inherited Vehicle Events
VehicleWater inherits from Base Vehicle Class, sharing it's events:
Base Vehiclescripting-reference/classes/base-classes/vehicle
NameDescription
CharacterAttemptEnter当角色尝试进入载具时触发
CharacterAttemptLeave当角色尝试离开载具时触发
CharacterEnter当角色完全进入载具时触发
CharacterLeave当角色完全离开载具时触发
Hit当载具撞击到某物时触发
TakeDamage当此载具受到伤害时触发

This class doesn't have own events.