
Originally Posted by
thetree
Have it in an if statement, so say you wanted to have it flying, then hovering you'd do this
Code:
if(Fly == 1) {E:applyForce(whatever)} else {E:applyForce(vec(0,0,E:mass()*9.015))} the E:applyForce(vec(0,0,E:mass()*9.015)) bit makes it hover where it is.
Correct me if I'm wrong anyone.
I tried this, but the object isn't holdable at a specific ponint. If you move it forward, it hovers up and it conflicts if you give the object another Up/Down command.

Originally Posted by
malum
9.015 is the rough formula to "defy gravity". It in no way keeps it in the same location. It actually floats upward a bit.
Code:
Vec = (HovHe - Weldedto:massCenter():z())*vec(0,0,1)* 1.35 * Weldedto:mass()
Weldedto:applyForce(Vec - Weldedto:vel() * 30)
Works, where HovHe is the z value you want your craft to hover at.
Also I tried this out, but is there any way to do this without giving the Chip the Y-Coordinate where to fly, I mean so you can change the hight by applyForce...Up() and -Up()? With your method it's only possible to do it with changing the coordinates slowly I think. I'll soon post the whole code of the Chip here, so it's maybe easyer to understand my problem, I can't explain it very well because of my limited english knowledge
.

Originally Posted by
lilneo
Uh doiii, physical properties? Choose the physical properties tool and uncheck "toggle gravity" and set the properties to whatever you want. Shoot the object and e2 chip on it... Viola, no gravity.
(As an alternative to using their method)
Yes, I know the tools, but I don't know much about E2 so I asked how to do it with E2.
But thank you all very much for your help.
EDIT:
Here's the code. Some parts are in german, sorry. Feel free to use it for fun
:
Code:
@name KINO
@outputs KameraAn Pos:vector Angle:angle
@inputs Objekt:entity An CamAn Front Back Left Right Up Down TurnL TurnR
@persist Sound SoundType:string HovHe
#(German:An = English:On)
#(German:Kamera = English:Camera)
runOnTick(1)
SoundType="npc/dog/dog_idlemode_loop1.wav"
#EE=findResult(findByModel("models/dav0r/hoverball.mdl"))
EE=Objekt
Player=findPlayerByName("Nompl")
Pos=EE:pos()
Angle=EE:angles()
#Unsichtbar, wenn Kamera an (Invisible when camera on)
if(KameraAn != 0)
{
EE:setColor(255,255,255,0)
}
else
{
EE:setColor(255,255,255,255)
}
#-------------------------------------------------------
#Basiseinstellungen (Basic setting)
if(first())
{
EE:setMaterial("spacebuild/body")
EE:setMass(3)
}
#-------------------------------------------------------
#Steuerung, wenn das Objekt an ist (Controll when object is on)
if(An != 0)
{
if(Sound == 0)
{
Sound=1
EE:soundPlay(0,0,SoundType)
}
KameraAn=CamAn
#-------------------------------------------------------
#Objekt abbremsen: (Slow down the Object)
#Abbremsen aller Bewegungen (Slow down all Movements)
if((Front+Back+Left+Right+Up+Down) == 0)
{
EE:applyForce(-(EE:vel())/2)
}
#Winkelstabilisierung (Slowdown for rotation)
if((TurnL+TurnR) == 0)
{
EE:applyAngForce(-(EE:angVel())/10)
}
#-------------------------------------------------------
#Objekt steuern (Controll the Object)
if(Front != 0)
{
EE:applyForce(EE:angles():forward())
}
if(Back != 0)
{
EE:applyForce(-(EE:angles():forward()))
}
if(Right != 0)
{
EE:applyForce(EE:angles():right())
}
if(Left != 0)
{
EE:applyForce(-(EE:angles():right()))
}
if(Up != 0)
{
EE:applyForce(vec(0,0,5))
}
if(Down != 0)
{
EE:applyForce(vec(0,0,-5))
}
if(TurnL != 0)
{
EE:applyAngForce(ang(0,2,0))
}
if(TurnR != 0)
{
EE:applyAngForce(ang(0,-2,0))
}
#-------------------------------------------------------
}
else
{
KameraAn=0
Sound=0
soundStop(0)
} I'm sure it is a terrible code but how I already said, I just started.
Bookmarks