Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

MsDoe

12
Posts
2
Topics
A member registered Mar 11, 2016

Recent community posts

One last hopeful bump on this! Nothing is working as far as local, well, anything goes. Haven't found anything that would make it work, either.

We need some details (which shader you were using, what the shader code is, what kind of shader), etc.

Hopeful bump on this! Haven't had any luck at all.

Hello! Sorry to come back here with another question, but I have an issue.

I'm using the function actor.setOrientation(Sup.Math.Quaternion); in my constructor to set an origin angle for my actor, from which I was hoping I could locally rotate the actor (the actor is a spinning wheel). Later in the code, I call actor.rotateLocal(offset Sup.Math.Quaternion), but it does not rotate locally. Instead, it rotates globally.

I know that the orientation is working properly because the wheel does in fact rotate to where it is supposed to be; however, rotations are still global and not in reference to this orientation angle. Am I missing something?

That's interesting, I can't seem to access properties that I've set in the class itself, and am only able to access variables that exist on Sup.Behavior as the superclass.... Strange. I'm sure I can figure it out, though.

Thanks! I ended up figuring this out when I realized that it wasn't pure JS that added the ability to have classes, it was TypeScript... so I was digging through the wrong documentation entirely. My issue is that I wasn't defining variables properly with name: type, and was instead doing let name = type;

Thanks!

(1 edit)

Also, how would one be able to call on properties stored in an actor's behavior? Like, if I wanted to grab the velocity from an object's behavior and that property was public, how would I reference it? Calling Sup.Actor.getBehavior just returns the class itself, not the instance of the class that I'm trying to refer to.

Hi there! I wanted to know how it is possible to add properties to a behavior for use in its update loop; When registering a behavior, you need to call the class itself, not an instance, but I can't find any way to add properties to the class itself, only how to add to an instance of said class. How is it possible to refer to properties on a class from within the class? For instance, in this code all the variables within update() throw errors

class ballBehavior extends Sup.Behavior{
constructor(ball)
{
super(ball);
let ballActor = new Sup.Actor("Ball");
ballActor.setPosition(0, 0, 0);
let ballAngle = 0;
let ballPosition = new Sup.Math.Vector3;
let ballVelocity = 0;
ballActor.addBehavior(ballBehavior);
}

update(){

this.ballAngle += this.ballVelocity;
//Constrains the angle between 0 and 2pi
if(this.ballAngle > Math.PI * 2){
this.ballAngle = 0 + this.ballAngle - Math.PI * 2;
}else if (this.ballAngle < 0){
this.ballAngle = Math.PI - this.ballAngle + Math.PI * 2;
}
//Maybe a little spinback on the pointer?
this.ballPosition = new Sup.Math.Vector3(Math.cos(this.ballAngle) * wheelActor.getLocalScaleX() * 100 / 100,
Math.sin(this.ballAngle) * wheelActor.getLocalScaleX() * 100 / 100, 0);

if(Sup.Input.wasKeyJustPressed("LEFT")){
this.ballVelocity = 0.5;
}


}
}