Skip to content

Instantly share code, notes, and snippets.

@MastaMan
MastaMan / touch-joystick.js
Created April 10, 2023 13:01
Main Joystick script for Playcanvas Project SVOYA Apartment
var TouchJoystick = pc.createScript('touchJoystick');
TouchJoystick.attributes.add('identifier', {
type: 'string',
default: 'joystick0',
title: 'Idenitifier',
description: 'A unique name for the joystick to refer to it by in the API. Joysticks are also buttons so this will also be the name of button in the API. It will give a warning in browser tools if the name is not unique.'
});
TouchJoystick.attributes.add('type', {
type: 'string',
@MastaMan
MastaMan / joystick-player-movement.js
Created April 10, 2023 13:00
Joystick Player Movement script for Playcanvas Project SVOYA Apartment
var JoystickPlayerMovement = pc.createScript('joystickPlayerMovement');
JoystickPlayerMovement.attributes.add('joystickId' , { type: 'string',
default: 'movement',
title: 'Joystick ID',
description: 'Enter Joystick ID'
});
JoystickPlayerMovement.prototype.initialize = function() {
this.FirstPersonMovement = this.entity.script.firstPersonMovement;
@MastaMan
MastaMan / joystick-camera-orbit.js
Created April 10, 2023 12:58
Joystick Camera Orbit script for Playcanvas Project SVOYA Apartment
var JoystickCameraOrbit = pc.createScript('JoystickCameraOrbit');
JoystickCameraOrbit.attributes.add('joystickId' , { type: 'string',
default: 'rotation',
title: 'Joystick ID',
description: 'Enter Joystick ID'
});
JoystickCameraOrbit.attributes.add('orbitSensitivity', {
type: 'number',
@MastaMan
MastaMan / change-material.js
Created April 4, 2023 13:26
Change Material script for Playcanvas Project SVOYA Apartment
var ChangeMaterial = pc.createScript('changeMaterial');
ChangeMaterial.attributes.add('trigger', {
title: 'Trigger Button',
type: 'entity'
});
ChangeMaterial.attributes.add('materials', {
title: 'Materials',
type: 'asset',
@MastaMan
MastaMan / change-color.js
Created April 4, 2023 09:29
Change Color script for Playcanvas Project SVOYA Apartment
var ChangeColor = pc.createScript('changeColor');
ChangeColor.attributes.add('trigger', {
title: 'Trigger Button',
type: 'entity'
});
ChangeColor.attributes.add('targetMaterial', {
title: 'Material',
description: 'Material for which the Diffuse color will change.',
@MastaMan
MastaMan / play-pause-button.js
Created April 3, 2023 14:18
Play/Pause TV script for Playcanvas Project SVOYA Apartment
var PlayPauseButton = pc.createScript('playPauseButton');
PlayPauseButton.attributes.add('playPauseButton', {type: 'entity'});
PlayPauseButton.attributes.add('playPlayImage', {type: 'entity'});
PlayPauseButton.attributes.add('playPauseImage', {type: 'entity'});
PlayPauseButton.attributes.add('playEvent', {
title: 'Play Event',
description: 'Set the TV screen material emissive map on this event.',
type: 'string',
default: 'tv:play'
@MastaMan
MastaMan / tv-screen.js
Created April 2, 2023 11:55
TV Screen script for Playcanvas Project SVOYA Apartment
var TvScreen = pc.createScript('tvScreen');
TvScreen.attributes.add('screenMaterial', {
title: 'Screen Material',
description: 'The screen material of the TV that displays the video texture.',
type: 'asset',
assetType: 'material'
});
TvScreen.attributes.add('playEvent', {
title: 'Play Event',
@MastaMan
MastaMan / video-texture.js
Created April 2, 2023 11:53
Video Texture script for Playcanvas Project SVOYA Apartment
var VideoTexture = pc.createScript('videoTexture');
VideoTexture.attributes.add('videoAsset', {
title: 'Video Asset',
description: 'MP4 video asset to play back on this video texture.',
type: 'asset'
});
VideoTexture.attributes.add('videoUrl', {
title: 'Video Url',
macroScript Working2Local
buttontext: "Worknig2Local"
category: "[3DGROUND]"
(
on execute do (
fn ConvertWorking2Local = (
if (selection.count == 0) do return messageBox "Please select objects" title: "Warning!"
toolMode.coordsys #working_pivot
local tm = WorkingPivot.getTM()
selection.pivot = tm.translationpart
<html>
<body>
<h1>Test title</h1>
</body>
</html>