@kunosyn/vex
v0.0.1
Published
An efficient, performance-minded voxel destruction model. Created by EternalEthel/qrisquinn (same person).
Maintainers
Readme
About
An efficient, performance-minded voxel destruction model. Created by EternalEthel/qrisquinn. Ported to Typescript for rbxts by savruun.
[!IMPORTANT] This package is a port of Vex 2.0 last updated in January of 2022 meaning this package is not updated anymore, it is reccommended you use @kunosyn/shatterbox for larger/newer projects.
Installation
Install package via NPM:
npm i @kunosyn/vexAdd path to tsconfig.json in compilerOptions.typeRoots
"typeRoots": ["node_modules/@kunosyn", ...]Add path to @kunosyn to default.project.json in rbxts_include/node_modules.
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"rbxts_include": {
"$path": "include",
"node_modules": {
"$className": "Folder",
"@kunosyn": {
"$path": "node_modules/@kunosyn"
}
}
},
}Done!
Usage Example
Here's some basic examples of using the vex module:
Destructible walls.
import { Workspace } from '@rbxts/services';
import Vex from '@kunosyn/vex';
const wall = Workspace.WaitForChild('Wall') as Part
const projectile = Workspace.WaitForChild('Projectile') as Part
const structure = new Vex(wall, {
voxelSize: 2,
lifetime: 15
})
projectile.Touched.Connect((hit) => {
if (hit === wall) {
structure.Destroy()
structure.ApplyForce(projectile.AssemblyLinearVelocity.mul(10), projectile.Position)
}
})Timed demolition.
import { Workspace } from '@rbxts/services';
import Vex from '@kunosyn/vex';
const building = Workspace.WaitForChild('Building') as Model;
task.wait(3)
const structure = new Vex(building, {
voxelSize: 2,
lifetime: 30,
weldAdjacent: false // Let the pieces fall independently.
})
structure.Destroy()
structure.ApplyForce(new Vector3(0, 1200, 0), building.PrimaryPart.Position);