View unanswered posts | View active topics It is currently Sun Jan 12, 2025 1:06 pm



Reply to topic  [ 11 posts ] 
 Non removable forces 
Author Message
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Non removable forces
Alright, so this is an issue that's been bugging me for a while.

When you have a system set up, through Lua, to move craft around completely without .ini code, you tend to have forces stack up and cause discrepancies in movement, despite what your Lua code is telling the object to do.

ClearForces and ClearImpulseForces doesn't really help this. At all.


Fri Mar 26, 2010 3:28 am
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Non removable forces
Maybe a stupid idea, but I think it would be possible to have the script spawn heavy mopixels that is sent directly into the craft from the side/top/bottom. Or negative mass mopixels that pull it.


Fri Mar 26, 2010 7:29 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Non removable forces
Negative mass particles behave strangely, like negative strength glows do, but even stranger. The impulses they produce are never very consistent.
However, with this project paul is doing the movement with lua, not ini/particle based anything. The forces are just a bit broken. I think this thread is a complaint in the vein of "this annoys me dan. fix it faster" more than a "what do I do now?", but cant be sure.

As an addendum, good to hear you're working on it somewhat :P


Fri Mar 26, 2010 7:49 am
Profile WWW
User avatar

Joined: Fri May 11, 2007 4:30 pm
Posts: 1040
Location: England
Reply with quote
Post Re: Non removable forces
one method of working around this would be to implement your own small little physics loop:

self.AccelY = self.ForceY/self.Mass;
self.AccelX = self.ForceX/self.Mass;
self.InitVelX = self.VelX;
self.InitVelY = self.VelY;
self.VelY = self.InitVelY + self.AccelY;
self.VelX = self.InitVelX + self.AccelX;
self.PosY = self.PosY+self.VelY;
self.PosX = self.PosX+self.VelX;
self.ForceX = 0;
self.ForceY = 0;

won't be as good as using the games physics engine, unit issues (vel=m/s, pos=pixels) and all force gets added instantaneously, but you can mess around with it and make it as complex as you want and at least you know what you're dealing with.


Fri Mar 26, 2010 3:12 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Non removable forces
The thing is, that's not too far from what I'm doing, and the engine still overlaps all lua velocity and overlap if there's some forces added up.

Some way to counter it would be lovely, but literally nothing I've tried has worked.


Fri Mar 26, 2010 3:16 pm
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Non removable forces
Does the system HAVE to be based on forces? If not, i've found that working with velocities works pretty well. I can post the script i use if you want. If it does... Well, i assume you have tried using impulse force?


Fri Mar 26, 2010 3:37 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Non removable forces
That's the thing.

I'm not doing anything related to forces.

I'm setting Velocity and RotAngle and nothing else.

The problem is that the game engine sometimes decides that because I hit something, a constantly applied lua script can be ignored in favor of doing its own calculations.

In fact, thinking about it further, this is actually exclusively a problem related to RotAngle. Velocity changes don't matter at all; it's just that RotAngle, for whatever reason, is considered an engine property on a significantly higher priority than it is a lua property.


Sat Mar 27, 2010 1:34 am
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Non removable forces
Hmm, odd. Tried using AngularVel instead of setting RotAngle, or just setting it to 0 every frame? I suspect that the engine might not be removing the angular velocity of an impact, so if it has a negative angular velocity and you're trying to rotate it in the positive direction at the same time, weird stuff will happen. Kinda like how you can partially negate gravity by constantly adding upwards velocity, but not enough to actually fly upwards.


Sat Mar 27, 2010 12:15 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Non removable forces
Constantly setting AngVel to 0 helps marginally but doesn't wholly solve the problem.

Also, "Kinda like how you can partially negate gravity by constantly adding upwards velocity, but not enough to actually fly upwards."

what


Sun Mar 28, 2010 1:46 am
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Non removable forces
If you make it fly upwards in Lua, as in, not fast or anything, just the force of gravity, kinda like how a helicopter does when it hovers.


Sun Mar 28, 2010 1:49 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Non removable forces
Haha oh wow I just realized that shook is exactly correct.

I had a post detailing why I didn't think so until I thought about and realized this:

if you set any engine property to itself plus anything else, the engine factor will be destabilized between lua updates by standard physics engine interactions

if you directly set the engine properties, there's no trouble at all

It seems really obvious, now, but I never really though that through.

Well, that solves that problem.


Sun Mar 28, 2010 4:19 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.072s | 14 Queries | GZIP : Off ]