Skip to content

Instantly share code, notes, and snippets.

@MastaMan
MastaMan / OpenMatEditorOnce.mcr
Last active April 1, 2022 10:14
Open 3Ds Max Editor Once | For 3DGROUND lessons
macroScript OpenMatEditorOnce
category:"[3DGROUND]"
toolTip:"OpenMatEditorOnce"
buttontext:"[M]"
(
on execute do
(
MatEditor.Open()
)
)
@MastaMan
MastaMan / loading.js
Created March 2, 2022 11:50
Splash screen script for lesson SVOYA Apartment
pc.script.createLoadingScreen(function (app) {
var showSplash = function () {
// splash wrapper
var wrapper = document.createElement('div');
wrapper.id = 'application-splash-wrapper';
document.body.appendChild(wrapper);
// splash
var splash = document.createElement('div');
splash.id = 'application-splash';
@MastaMan
MastaMan / Export2Playcanvas.ms
Last active March 1, 2022 09:54
Script helps export fbx files for Playcanvas
try (DestroyDialog rExport2Playcanvas) catch ()
rollout rExport2Playcanvas "Export2Playcanvas" (
fn findFile f n = (
files = getFiles (f + "*.jpg")
for ff in files where (MatchPattern (filenameFromPath ff) pattern: (n + "_*.jpg")) do (
return ff
)
return undefined
var FirstPersonMovement = pc.createScript('firstPersonMovement');
FirstPersonMovement.attributes.add('camera', {
type: 'entity',
description: 'Optional, assign a camera entity, otherwise one is created'
});
FirstPersonMovement.attributes.add('power', {
type: 'number',
default: 2500,
@MastaMan
MastaMan / ui.js
Created January 27, 2022 09:08
UI - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var UI = pc.createScript('ui');
var buttonSize = '30px';
var colors = [
{
color: new pc.Color(255.0/255.0, 131.0/255.0, 0/255.0),
hex: "#ff8300"
},
{
@MastaMan
MastaMan / setDisk.js
Created January 27, 2022 09:06
Set Disk - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var SetDisk = pc.createScript('setDisk');
var currentId = 0;
// initialize code called once per entity
SetDisk.prototype.initialize = function() {
this.app.on('setdisk', function (data) {
var objs = this.app.root.findByTag(data);
console.log(objs);
@MastaMan
MastaMan / setColor.js
Last active January 27, 2022 10:31
Set Colors - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var SetColor = pc.createScript('setColor');
SetColor.attributes.add('tag', {type: 'string', 'default': 'carpaint', title: 'Material Tag'});
// initialize code called once per entity
SetColor.prototype.initialize = function() {
this.app.on('setcolor', function (color) {
var mats = this.app.assets.findByTag(this.tag);
for (i = 0; i < mats.length; i++) {
var material = mats[i].resource;
@MastaMan
MastaMan / openDoors.js
Created January 27, 2022 09:04
Open Doors - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var OpenDoors = pc.createScript('openDoors');
OpenDoors.attributes.add('fromAngle', {type: 'number', default: 0, title: 'From Angle'});
OpenDoors.attributes.add('toAngle', {type: 'number', default: 70, title: 'To Angle'});
OpenDoors.attributes.add('speed', {type: 'number', default: 150.0, title: 'Speed'});
OpenDoors.attributes.add('inverted', {type: 'boolean', 'default': false});
OpenDoors.attributes.add('axis', {type: 'string', 'default': 'z'});
// initialize code called once per entity
OpenDoors.prototype.initialize = function() {
@MastaMan
MastaMan / wheelRotation.js
Created January 27, 2022 09:02
Wheel Rotation - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var WheelRotation = pc.createScript("wheelRotation");
WheelRotation.attributes.add("speed", {
type: "number",
"default": 57.2958
});
WheelRotation.attributes.add("inverted", {
type: "boolean",
"default": !1
@MastaMan
MastaMan / hotspot.js
Created January 14, 2022 11:54
Hotspots - Creation of the Lamborghini Urus project (WebGL-PlayCanvas)
var Hotspot = pc.createScript('hotspot');
Hotspot.attributes.add("cameraEntity", {type: "entity", title: "Camera Entity"});
Hotspot.attributes.add("radius", {type: "number", title: "Radius"});
Hotspot.attributes.add("maxAlpha", {type: "number", title: "Alpha", default: 0.7});
Hotspot.attributes.add("fadeDropOff", {
type: "number",
default: 0.4,
title: "Fade Drop Off",
description: "When to start fading out hotspot relative to the camera direction. 1 for when hotspot is directly inline with the camera. 0 for never."