Look at E:toWorld(V), the object will rotate around the entity E. Make the X and Y of V equal a cosine and sine wave. (Someone should explain this more in-depth after me I suppose).
This is my 2nd day using E2 so I'm not very knowledgeable. I'm interested in making a Sphere that orbits around another sphere but I have no idea how to go about it.
Look at E:toWorld(V), the object will rotate around the entity E. Make the X and Y of V equal a cosine and sine wave. (Someone should explain this more in-depth after me I suppose).
I made an example for you:
Pretty self-explainatory.Code:@name Orbit @persist Count interval(10) Count += 0.01 X1 = 40*cosr(Count) Y1 = 40*sinr(Count) Z1 = 50 X2 = 25*cosr(3*Count) Y2 = 25*sinr(3*Count) Z2 = 0 holoCreate(1) holoScale(1,vec(2,2,2)) holoPos(1,entity():pos()+vec(X1,Y1,Z1)) holoCreate(2) holoPos(2,holoEntity(1):pos()+vec(X2,Y2,Z2))
holoPos(1,entity(): pos+vec(X1,Y1,Z1)) sets the position for the first hologram, right? (being the position of the e2 chip)
holoPos(2,holoEntity(1):+vec(X2,Y2,Z2)) sets the default position for the second hologram to be the position of the first hologram.
The rest is basic circlemaking.
EDIT: very inaccurate representation of the sun/earth/moon as an extra example
Code:X1 = 0 Y1 = 0 Z1 = 100 X2 = 200*cosr(2*Count) Y2 = 200*sinr(2*Count) Z2 = 0 X3 = 20*cosr(10*Count) Y3 = 20*sinr(10*Count) Z3 = 0 holoCreate(1) holoModel(1,"icosphere3") holoScale(1,vec(8,8,8)) holoColor(1,vec(255,200,0)) holoPos(1,entity():pos()+vec(X1,Y1,Z1)) holoCreate(2) holoModel(2,"icosphere3") holoScale(2,vec(2,2,2)) holoColor(2,vec(0,0,255)) holoPos(2,holoEntity(1):pos()+vec(X2,Y2,Z2)) holoCreate(3) holoModel(3,"icosphere3") holoScale(3,vec(0.5,0.5,0.5)) holoColor(3,vec(150,150,150)) holoPos(3,holoEntity(2):pos()+vec(X3,Y3,Z3))
Last edited by Jeroenvw; 09-02-2010 at 04:01 AM.
Confuses the hell out of me but I'm sure I can figure it out. Thanks for the example!
I've figured out how it works now. Thanks everyone for your help
Another quick question. I'm making a Solar System Hologram and I have all the planets Orbiting around the "Sun" but I can't figure out how to make a planet orbit around another planet that is orbiting the sun, like a Moon. Any help with this would be welcome.
Here is the Code I have so far.
Code:@name Solar System WIP @persist Count interval(10) Count +=0.01 X1=0*cosr(Count) Y1=0*sinr(Count) Z1=100 X2=150*cosr(1*Count) Y2=150*sinr(1*Count) Z2=100 X3=250*cosr(1.5*Count) Y3=250*sinr(1.5*Count) Z3=100 X4=375*cosr(2.5*Count) Y4=375*sinr(2.5*Count) Z4=100 X5=500*cosr(0.25*Count) Y5=500*sinr(0.25*Count) Z5=100 X6=650*cosr(0.50*Count) Y6=650*sinr(0.50*Count) Z6=100 holoCreate(1) holoScale(1,vec(15,15,15)) holoPos(1,entity():pos()+vec(X1,Y1,Z1)) holoModel(1, "hqicosphere2") holoMaterial(1, "models/props_lab/xencrystal_sheet") holoCreate(2) holoScale(2,vec(15.5,15.5,15.5)) holoPos(2,entity():pos()+vec(0,0,100)) holoModel(2, "hqicosphere2") holoMaterial(2, "models/effects/comball_tape") holoCreate(3) holoScale(3,vec(4,4,4)) holoPos(3,entity():pos()+vec(X2,Y2,Z2)) holoModel(3, "hqicosphere") holoMaterial(3, "models/props_pipes/pipesystem01a_skin3") holoCreate(4) holoScale(4,vec(5,5,5)) holoPos(4,entity():pos()+vec(X3,Y3,Z3)) holoModel(4, "hqicosphere") holoMaterial(4, "models/props_pipes/pipesystem01a_skin2") holoCreate(5) holoScale(5,vec(2,2,2)) holoPos(5,entity():pos()+vec(X4,Y4,Z4)) holoModel(5, "hqicosphere") holoMaterial(5, "models/shadertest/shader4") holoCreate(6) holoScale(6,vec(6.2,6.2,6.2)) holoPos(6,entity():pos()+vec(X5,Y5,Z5)) holoModel(6, "hqicosphere") holoColor(6,vec(0,150,0)) holoMaterial(6, "models/alyx/emptool_glow") holoCreate(7) holoScale(7,vec(8.6,8.6,2)) holoPos(7,entity():pos()+vec(X5,Y5,Z5)) holoModel(7, "hqtorus2") holoMaterial(7, "models/props_combine/portalball001_sheet") holoCreate(8) holoScale(8,vec(6,6,6)) holoPos(8,entity():pos()+vec(X5,Y5,Z5)) holoModel(8, "hqicosphere") holoColor(8,vec(0,50,0)) holoCreate(9) holoScale(9,vec(13,13,13)) holoPos(9,entity():pos()+vec(X6,Y6,Z6)) holoModel(9, "hqicosphere") holoMaterial(9, "models/effects/splode_sheet") holoCreate(10) holoScale(10,vec(13.2,13.2,13.2)) holoPos(10,entity():pos()+vec(X6,Y6,Z6)) holoModel(10, "hqicosphere") holoMaterial(10, "models/alyx/emptool_glow") holoColor(10,vec(255,196,3))
Last edited by Magos Mechanicus; 09-03-2010 at 04:05 AM. Reason: Multipost merge
Same idea as before with the planet orbiting the sun. Use Planet:toWorld(V), the X and Y of V being sine and cosine waves, and make that the position of the moon.
I once used the rotate, dont know how I did it tho :/
holoPos(1,rotate(curtime()*60),0,0) or so
See what I did there?
You can repeat this until you have the desired amount of sattelites.Code:holoPos(N,holoEntity(N-1):+vec(XN,YN,ZN))
example:
Code:holoPos(3,holoEntity(2):pos()+vec(X3,Y3,Z3)) holoPos(4,holoEntity(3):pos()+vec(X4,Y4,Z4)) holoPos(5,holoEntity(4):pos()+vec(X5,Y5,Z5))
Took me about 10 minutes of staring blankly and rereading the code to understand it but I got it now. Thanks alot!
What about Vertical Orbit? Is it possible to make a hologram go around another at a vertical angle versus a horizontal angle?
Last edited by Magos Mechanicus; 09-03-2010 at 04:06 AM. Reason: Doublepost merge.
Bookmarks