some more tweaks

This commit is contained in:
RandomityGuy 2023-06-19 01:09:35 +05:30
parent e910bd9c40
commit 026fc45c17
6 changed files with 48 additions and 16 deletions

View file

@ -232,7 +232,7 @@ class CameraController extends Object {
var up = new Vector(0, 0, 1);
up.transform(orientationQuat.toMatrix());
var directionVector = new Vector(1, 0, 0);
var cameraVerticalTranslation = new Vector(0, 0, 0.325);
var cameraVerticalTranslation = new Vector(0, 0, 0.55);
var q1 = new Quat();
q1.initRotateAxis(0, 1, 0, CameraPitch);
@ -248,7 +248,7 @@ class CameraController extends Object {
camera.target = marblePosition.add(cameraVerticalTranslation);
var closeness = 0.1;
var rayCastOrigin = marblePosition.add(level.currentUp.multiply(marble._radius));
var rayCastOrigin = marblePosition.add(level.currentUp.multiply(marble._radius)).add(cameraVerticalTranslation);
var processedShapes = [];
for (i in 0...3) {
@ -289,7 +289,7 @@ class CameraController extends Object {
var rightVec = camera.up.cross(forwardVec).normalized();
var upVec = forwardVec.cross(rightVec);
camera.target = marblePosition.add(upVec.multiply(0.3));
camera.target = marblePosition.add(upVec.multiply(0.55));
camera.up = upVec;
continue;
}

View file

@ -194,6 +194,9 @@ class Marble extends GameObject {
public var _radius = 0.2;
var _prevRadius:Float;
var _renderScale:Float = 1;
var _marbleScale:Float = 1;
var _defaultScale:Float = 1;
var _maxRollVelocity:Float = 15;
var _angularAcceleration:Float = 75;
@ -404,6 +407,9 @@ class Marble extends GameObject {
var avgRadius = (b.xSize + b.ySize + b.zSize) / 6;
if (isUltra) {
this._radius = 0.3;
this._renderScale = 0.3 / avgRadius;
this._marbleScale = this._renderScale;
this._defaultScale = this._marbleScale;
marbleDts.scale(0.3 / avgRadius);
} else
this._radius = avgRadius;
@ -1821,18 +1827,32 @@ class Marble extends GameObject {
updatePowerupStates(timeState.currentAttemptTime, timeState.dt);
if (this._radius != 0.6666 && timeState.currentAttemptTime - this.megaMarbleEnableTime < 10) {
var s = this._renderScale * this._renderScale;
if (s <= this._marbleScale * this._marbleScale)
s = 0.1;
else
s = 0.4;
s = timeState.dt / s * 2.302585124969482;
s = 1.0 / (s * (s * 0.2349999994039536 * s) + s + 1.0 + 0.4799999892711639 * s * s);
this._renderScale *= s;
s = 1 - s;
this._renderScale += s * this._marbleScale;
var marbledts = cast(this.getChildAt(0), DtsObject);
marbledts.setScale(this._renderScale);
if (this._radius != 0.675 && timeState.currentAttemptTime - this.megaMarbleEnableTime < 10) {
this._prevRadius = this._radius;
this._radius = 0.6666;
this.collider.radius = 0.6666;
var marbledts = cast(this.getChildAt(0), DtsObject);
marbledts.scale(this._radius / this._prevRadius);
this._radius = 0.675;
this.collider.radius = 0.675;
this._marbleScale *= 2.25;
var boost = this.level.currentUp.multiply(5);
this.velocity = this.velocity.add(boost);
} else if (timeState.currentAttemptTime - this.megaMarbleEnableTime > 10) {
if (this._radius != this._prevRadius) {
this._radius = this._prevRadius;
this.collider.radius = this._radius;
var marbledts = cast(this.getChildAt(0), DtsObject);
marbledts.scale(this._prevRadius / 0.6666);
this._marbleScale = this._defaultScale;
}
}
@ -1884,10 +1904,18 @@ class Marble extends GameObject {
}
}
public function getMass() {
if (this.level.timeState.currentAttemptTime - this.megaMarbleEnableTime < 10) {
return 5;
} else {
return 1;
}
}
public function useBlast() {
if (this.level.blastAmount < 0.25 || this.level.game != "ultra")
return;
var impulse = this.level.currentUp.multiply(Math.max(Math.sqrt(this.level.blastAmount), this.level.blastAmount) * 10);
var impulse = this.level.currentUp.multiply(this.level.blastAmount * 8);
this.applyImpulse(impulse);
AudioManager.playSound(ResourceLoader.getResource('data/sound/use_blast.wav', ResourceLoader.getAudio, this.soundResources));
this.blastWave.doSequenceOnceBeginTime = this.level.timeState.timeSinceLoad;
@ -1971,9 +1999,10 @@ class Marble extends GameObject {
this.teleportEnableTime = null;
if (this._radius != this._prevRadius) {
this._radius = this._prevRadius;
this._marbleScale = this._renderScale = this._defaultScale;
this.collider.radius = this._radius;
var marbledts = cast(this.getChildAt(0), DtsObject);
marbledts.scale(this._prevRadius / 0.6666);
marbledts.scale(this._prevRadius / 0.675);
}
}
}

View file

@ -323,7 +323,7 @@ class MarbleWorld extends Scheduler {
// ls.perPixelLighting = false;
var shadow = scene.renderer.getPass(h3d.pass.DefaultShadowMap);
shadow.power = 0.5;
shadow.power = 1;
shadow.mode = Dynamic;
shadow.minDist = 0.1;
shadow.maxDist = 200;

View file

@ -68,7 +68,9 @@ class SuperJump extends PowerUp {
public function use(timeState:TimeState) {
var marble = this.level.marble;
marble.velocity = marble.velocity.add(this.level.currentUp.multiply(20));
var masslessFactor = marble.getMass() * 0.7 + 1 - 0.7;
var boost = this.level.currentUp.multiply(20 * masslessFactor / marble.getMass());
marble.velocity = marble.velocity.add(boost);
this.level.particleManager.createEmitter(superJumpParticleOptions, this.sjEmitterParticleData, null, () -> marble.getAbsPos().getPosition());
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity
// if (!this.level.rewinding)

View file

@ -80,7 +80,8 @@ class SuperSpeed extends PowerUp {
// Determine the necessary rotation to rotate the up vector to the contact normal.
quat2.initMoveTo(this.level.currentUp, marble.lastContactNormal);
movementVector.transform(quat2.toMatrix());
marble.velocity = marble.velocity.add(movementVector.multiply(-25));
var masslessFactor = marble.getMass() * 0.7 + 1 - 0.7;
marble.velocity = marble.velocity.add(movementVector.multiply(-25 * masslessFactor / marble.getMass()));
// marble.body.addLinearVelocity(Util.vecThreeToOimo(movementVector).scale(24.7)); // Whirligig's determined value
// marble.body.addLinearVelocity(this.level.currentUp.scale(20)); // Simply add to vertical velocity

View file

@ -13,7 +13,7 @@ import src.MarbleWorld;
class Trapdoor extends DtsObject {
var lastContactTime = -1e8;
var timeout:Float = 0.2;
var timeout:Float = 0;
var lastDirection:Int;
var lastCompletion:Float = 0;