-
Posts
682 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Marcousik
-
Monster truck & speed car demo - nice Physics LE4.5
Marcousik posted a blog entry in Marcousik's Creations Blog
That's just monster truck fun - This driving/vehicle physics is (well I think) definitivly better than 4.3 ? Here is a speed car with speed boooosst feature (max 50 m/s) Boost Car.mp4 -
Monster truck & speed car demo - nice Physics LE4.5
Marcousik commented on Marcousik's blog entry in Marcousik's Creations Blog
Hey Yue, What I would change: 1) SetFriction(10,10) should be enough 2) What are the mass of tires and car you used ? -> make them to script properties so you can change and test them quickly 3) Why don't you use: self.suspensionJoint:SetTargetAngle(0) --at the middle self.suspensionJoint:SetMotorSpeed(1) -- 1 m/s self.suspensionJoint:SetStrength(100) --defatul is 1000 self.suspensionJoint:EnableMotor() for your suspensions -> slider joints. 4) that is too much: motor:SetMotorSpeed(100000000) I would set it to max 5000 to begin 5) As Josh said, you can't make it climb if the speed is constant, so you have to make this too: if App.window:KeyDown(Key.Up) then self.currspeed = self.currspeed + 10 if self.currspeed>self.motorspeed then self.currspeed=self.motorspeed end if self.currspeed == 10 then self.wheelJoint:EnableMotor() end self.wheelJoint:SetMotorSpeed(self.currspeed) end if App.window:KeyDown(Key.Down) then self.currspeed = self.currspeed - 10 if self.currspeed<-self.motorspeed then self.currspeed=-self.motorspeed end self.wheelJoint:SetMotorSpeed(self.currspeed) end 6) Try simply this script: (it is really ok - why not?) and try to change the values so you will learn the car's behavior: -
Smoothed car drive - Leadwerks 4.5
Marcousik commented on Marcousik's blog entry in Marcousik's Creations Blog
Hey Yue, I did this to avoid this problem for sure: set the chassis collision type to "character" and set the tires to collision type "debris". Because there is no collision between character and debris. You have to control the mass of the tires and chassis too: big chassis mass + little tires mass = crazy jumping. I would not fix the tires directly on your "MontaCargas", instead of this fix them on a simple box (that you have to create, just as big as your model is) and set the MontaCargas als child, just as a decoration object with no shape. If the simple box becomes drivable, you can add whatever you want as "deco" model... Set then the box a invisible material to hide it. It is maybe fake... but it runs -
Smoothed car drive - Leadwerks 4.5
Marcousik commented on Marcousik's blog entry in Marcousik's Creations Blog
The question is how realistic should that be, well making a monster truck is sure a challenge ? Normal cars doesn't have to climb to much or just make a soft road like 10-15 slope rotation. This car climbs a 20% road .. Just check the friction(5,5) on the tires! Maybe for a monster truck should the tires be bigger ? (not tested) -
I'm just happy to get this work here is a demo: This is actually better than driving in 4.3 because cars are now able to jump or crash without experimenting crazy rotations or whatever ? Here is the script to make this: > Here the values I used: > And here what changed: Is written in dark: ------------------------------------- function Script:Start() -- [...........] -- Construit les amortisseurs: / suspensions local n local pos for n=0,3 do pos=self.entity:GetPosition(true) self.Axes[n]:SetMass(self.TireMass) self.Amortisseurs[n]=Joint:Slider(pos.x, pos.y, pos.z, 0,1,0, self.Axes[n], self.entity) self.Amortisseurs[n]:EnableLimits() self.Amortisseurs[n]:SetLimits(-0.25/2,0.25/2) self.Amortisseurs[n]:SetTargetAngle(-self.Amort) --at the middle if 0 self.Amortisseurs[n]:SetMotorSpeed(10000) ------------- vitesse de la pompe/ suspensions speed self.Amortisseurs[n]:SetStrength(self.Force) --defatul is 1000 self.Amortisseurs[n]:EnableMotor() end -- [...........] ----- I removed the backward suspensions with 2* forces because this only depends on the positions of the suspensions on the chassis. ----- Making them symmetrical is ok to solve this. ---------------------------------------- function Script:UpdatePhysics() if self.MyCar==1 and InCar>0 then -- Traite la direction: local turning=0 local direction=self.Volants[0]:GetAngle() if window:KeyDown(Key.Left) then direction=direction-5 turning=-1 elseif window:KeyDown(Key.Right) then direction=direction+5 turning=1 elseif window:KeyDown(Key.Left)==false and window:KeyDown(Key.Right)== false then if Math:Round(direction)>0 then direction=direction-5 elseif Math:Round(direction)<0 then direction=direction+5 end end self.Volants[0]:SetAngle(direction) self.Volants[1]:SetAngle(direction) -- Traite l'acceleration: local Gas=0 if window:KeyDown(Key.Up) then Gas=1 self.currspeed = self.currspeed + 10 if self.currspeed>self.SpeedMax then self.currspeed=self.SpeedMax end elseif window:KeyDown(Key.Down) then Gas=-1 self.currspeed = self.currspeed - 10 if self.currspeed<-self.SpeedMax then self.currspeed=-self.SpeedMax end end if Gas==0 then self.currspeed=0 for n=0,3 do self.Rouages[n]:DisableMotor() end else for n=0,3 do if self.Rouages[n]:MotorEnabled()==false then self.Rouages[n]:EnableMotor() end self.Rouages[n]:SetTargetAngle(self.Rouages[n]:GetAngle()+1000) self.Rouages[n]:SetMotorSpeed(self.currspeed) self.Tires[n]:SetOmega(self.Tires[n]:GetOmega()*Vec3(5,5,5)) --------- make the car go faster end end --Smoothing: if turning==0 then self.entity:SetOmega(self.entity:GetOmega()*Vec3(-1,-1,-1)) else self.entity:SetOmega(0,turning*Gas,0) end self.Axes[0]:SetOmega(self.Axes[0]:GetOmega()*Vec3(-1,-1,-1)) self.Axes[1]:SetOmega(self.Axes[1]:GetOmega()*Vec3(-1,-1,-1)) self.Axes[2]:SetOmega(self.Axes[2]:GetOmega()*Vec3(-1,-1,-1)) self.Axes[3]:SetOmega(self.Axes[3]:GetOmega()*Vec3(-1,-1,-1)) self.Axes[0]:SetVelocity(self.Axes[0]:GetVelocity()*Vec3(1,0.5,1)) self.Axes[1]:SetVelocity(self.Axes[1]:GetVelocity()*Vec3(1,0.5,1)) self.Axes[2]:SetVelocity(self.Axes[2]:GetVelocity()*Vec3(1,0.5,1)) self.Axes[3]:SetVelocity(self.Axes[3]:GetVelocity()*Vec3(1,0.5,1)) -- fake wheels update: self.Wheels[0]:SetMatrix(self.Tires[0]:GetMatrix()) self.Wheels[1]:SetMatrix(self.Tires[1]:GetMatrix()) self.Wheels[2]:SetMatrix(self.Tires[2]:GetMatrix()) self.Wheels[3]:SetMatrix(self.Tires[3]:GetMatrix()) self.Wheels[0]:SetPosition(self.PosWheels[0]+Vec3(0,self.Amortisseurs[0]:GetAngle()/6,0)) self.Wheels[1]:SetPosition(self.PosWheels[1]+Vec3(0,self.Amortisseurs[1]:GetAngle()/6,0)) self.Wheels[2]:SetPosition(self.PosWheels[2]+Vec3(0,self.Amortisseurs[2]:GetAngle()/6,0)) self.Wheels[3]:SetPosition(self.PosWheels[3]+Vec3(0,self.Amortisseurs[3]:GetAngle()/6,0)) end
-
It is possible to drive in Le 4.5, but first you have to build a little car system, here is what was made until now: I will expose now how far I am with programming this, so that other members can maybe work on this: This is the structure I created: In blue are the most important children to make the car: - the "wheels" - are fake decorativ wheels to make the car looks like a car (not so important) - The "axe" children are pivots that will build through the script the suspensions. (slider joint) - The "direction" children are pivots that will build the steering system (hinge joint) - The "roue" children are cylinder CSG to make the tires. (hinge joint) Here is the script added on the "jeeplight" main object: that is CSG box with invisible material. Okay let see the script: ------------------------------------------------------ Script variables properties: Script.CarMass=200--int "Car Mass" Script.TireMass=10--int "Tire Mass" Script.SpeedMax=1000--int "Max speed" Script.Amort=0.3--float "Amort, long" Script.Force=2000--int "Amort, force" Script.Rayon=0.5--float "Roue, Rayon" Script.Epaiss=1--float "Pneus, Épaisseur" Script.SeeWheels = false --bool "Voir Roues" ------- not so important Script.traction=4--int "traction 2/4" ------------------------------------------------------- function Script:Start() -- Catch the children: self.Axes={} self.Axes[0]=self.entity:FindChild("AxeAvG") self.Axes[1]=self.entity:FindChild("AxeAvD") self.Axes[2]=self.entity:FindChild("AxeArG") self.Axes[3]=self.entity:FindChild("AxeArD") self.Directions={} self.Directions[0]=self.entity:FindChild("DirectionAvG") self.Directions[1]=self.entity:FindChild("DirectionAvD") self.Tires={} -- "real" tires - invisible cylinders self.Tires[0]=self.entity:FindChild("RoueAvG") self.Tires[1]=self.entity:FindChild("RoueAvD") self.Tires[2]=self.entity:FindChild("RoueArG") self.Tires[3]=self.entity:FindChild("RoueArD") self.Wheels={} --- fake wheels "decorativ" not so important self.Wheels[0]=self.entity:FindChild("WheelAvG") self.Wheels[1]=self.entity:FindChild("WheelAvD") self.Wheels[2]=self.entity:FindChild("WheelArG") self.Wheels[3]=self.entity:FindChild("WheelArD") for n=0,3 do self.Wheels[n]:SetParent(self.entity) end self.PosWheels={} self.PosWheels[0]=self.Wheels[0]:GetPosition() self.PosWheels[1]=self.Wheels[1]:GetPosition() self.PosWheels[2]=self.Wheels[2]:GetPosition() self.PosWheels[3]=self.Wheels[3]:GetPosition() for n=0,3 do self.Tires[n]:SetScale(self.Epaiss,self.Rayon*2,self.Rayon*2) self.Tires[n]:SetFriction(10,10) end -- Joints: self.Volants={} self.Rouages={} self.Amortisseurs={} self.currspeed=0 self.entity:SetMass(self.CarMass) -- Construit les amortisseurs: / ------------------------------------- suspensions local n local pos for n=0,3 do pos=self.Axes[n]:GetPosition(true) self.Axes[n]:SetMass(self.TireMass) self.Amortisseurs[n]=Joint:Slider(pos.x, pos.y, pos.z, 0,1,0, self.Axes[n], self.entity) self.Amortisseurs[n]:EnableLimits() self.Amortisseurs[n]:SetLimits(-0.1/2,0.1/2) self.Amortisseurs[n]:SetTargetAngle(-self.Amort) --at the middle if 0 self.Amortisseurs[n]:SetMotorSpeed(1) -- 1 m/s -- vitesse de la pompe self.Amortisseurs[n]:SetStrength(self.Force) --defatul is 1000 self.Amortisseurs[n]:EnableMotor() -- self.Amortisseurs[n]:SetSpring(50000) end -- Double la force des amortisseurs arrieres / --------------------- make the backward suspensions with 2* forces self.Amortisseurs[2]:SetStrength(self.Force*2) self.Amortisseurs[3]:SetStrength(self.Force*2) self.Amortisseurs[2]:SetMotorSpeed(2) self.Amortisseurs[3]:SetMotorSpeed(2) -- Volant: - ------------------------------------------steering: Forward for n=0,1 do pos=self.Directions[n]:GetPosition(true) self.Directions[n]:SetMass(self.TireMass) self.Volants[n]=Joint:Hinge(pos.x, pos.y, pos.z, 0,1,0, self.Directions[n], self.Axes[n]) self.Volants[n]:SetAngle(0) self.Volants[n]:EnableLimits() self.Volants[n]:SetLimits(-30,30) self.Volants[n]:SetMotorSpeed(200) self.Volants[n]:EnableMotor() end -- On attache les roues: /--------------------------------------- attach the tires for n=0,3 do pos=self.Tires[n]:GetPosition(true) self.Tires[n]:SetMass(self.TireMass) if n<2 then self.Rouages[n]=Joint:Hinge(pos.x, pos.y, pos.z, 1,0,0, self.Tires[n], self.Directions[n]) else self.Rouages[n]=Joint:Hinge(pos.x, pos.y, pos.z, 1,0,0, self.Tires[n], self.Axes[n]) end end end ------------------------------------- function Script:UpdatePhysics() if self.MyCar==1 and InCar>0 then --- these ar my own variables to let the player ingame use the car (not so important for now) -- Traite la direction: --- --------------------manage the steering local direction=self.Volants[0]:GetAngle() if window:KeyDown(Key.Left) then direction=direction-5 elseif window:KeyDown(Key.Right) then direction=direction+5 elseif window:KeyDown(Key.Left)==false and window:KeyDown(Key.Right)== false then if Math:Round(direction)>0 then direction=direction-5 elseif Math:Round(direction)<0 then direction=direction+5 end end self.Volants[0]:SetAngle(direction) self.Volants[1]:SetAngle(direction) -- Traite l'acceleration:---------------------------------------------------------- manage acceleration local Gas=0 if window:KeyDown(Key.Up) then Gas=1 self.currspeed = self.currspeed + 10 if self.currspeed>self.SpeedMax then self.currspeed=self.SpeedMax end elseif window:KeyDown(Key.Down) then Gas=1 self.currspeed = self.currspeed - 10 if self.currspeed<-self.SpeedMax then self.currspeed=-self.SpeedMax end end if Gas==0 then self.currspeed=0 for n=0,self.traction-1 do self.Rouages[n]:DisableMotor() end else for n=0,self.traction-1 do if self.Rouages[n]:MotorEnabled()==false then self.Rouages[n]:EnableMotor() end self.Rouages[n]:SetTargetAngle(self.Rouages[n]:GetAngle()+500) self.Rouages[n]:SetMotorSpeed(self.currspeed) end end --limite la velocite angulaire / ----------------------This limits the "twisting" of the car while fast driving, it is not enough but better self.entity:SetOmega(0,0,0) -- fake wheels update: self.Wheels[0]:SetMatrix(self.Tires[0]:GetMatrix()) self.Wheels[1]:SetMatrix(self.Tires[1]:GetMatrix()) self.Wheels[2]:SetMatrix(self.Tires[2]:GetMatrix()) self.Wheels[3]:SetMatrix(self.Tires[3]:GetMatrix()) self.Wheels[0]:SetPosition(self.PosWheels[0]) self.Wheels[1]:SetPosition(self.PosWheels[1]) self.Wheels[2]:SetPosition(self.PosWheels[2]) self.Wheels[3]:SetPosition(self.PosWheels[3]) end --------------------------------- On the posted image above the used properties can be read. Most important are the force and the car mass parameters. Here is what I could test: - I could make out of this a rapid car but I encounter the problem that the car is bouncing in chaos on the road as the acting forces on the chassis are big big. - Augmnenting the mass makes the joints too weak. - I get the idea that the car actually doesn't have 2 axles as it maybe should have. The 2 wheels forward are not bound through an axle just like the backwards too. - As the car drives, the back of the chassis tends to sink to the floor/terrain, that's why I doubled the suspensions forces of the backwards wheels There much more to test in this. (sorry if my english is not so english ?)
-
Fun driving in Leadwerks 4.5
Marcousik commented on Marcousik's blog entry in Marcousik's Creations Blog
That's right, I'm just working on to look for a smoother drive... I did not use SetSpring... I used SetStrength. The car gets acceleration using SetMotorSpeed() & SetTargetAngle(GetAngle()+200) on the 4 wheels... The good is the drive feels real, fast and stable (no crazy crash) , collisions are good too, I think better than in 4.3 if I get this smoothed Question: How is SetSpring() to use ? One time in Start() as start value or in UpdatePhysics() ? Which values (0-100) ? -
Little demo I made about driving in Leadwerks 4.5 with "self-made" vehicle (well the model is not from me) How to make ? -> https://www.leadwerks.com/community/blogs/entry/2216-simple-car-improved/ enjoy!
-
I forgot: suspensionJoint:EnableMotor now, it runs ok
-
Hey I know you can use for this the nice shader of Shadmar, but now if you want to try something else, This is somewhat like you can obtain if you use a big light sphere rounding around the player. I speed up the cycle quicker for the video to see all the day/night. I used the directional light rotation for the shadows, the color of the sky-sphere for the colorourfull effect and the color of the directional light for the luminosity, getting the no shadow night light. Clouds/rain has been hidden to see better. Here is a demo:
-
Rainy weather in forest - performance test LE 4.3
Marcousik commented on Marcousik's blog entry in Marcousik's Creations Blog
Thx, yes it's almost okay, it still has to be improved like shutting down the sunlight and but yes it's ok -
Rainy weather in forest - performance test LE 4.3
Marcousik posted a blog entry in Marcousik's Creations Blog
I'm happy with this because I spent a long time in testing how to make rain without slowing the game too much. I wanted the rain to have "splash" effect on the ground and to stop correctly as the player could stay under a roof or hides under a big stone etc etc.. I got big problems with collision testing and very low performances when using the shaped vegetation tool. Now that's fine, because I do not use the collision anymore, saving much performances. Here is a little demo: Here is a bit longer one with 2 rainfalls: Hope you enjoy ! -
Hello there is something I'm not sure... Until now I can't really see a really difference between LE 4 and 5 examples because LE4 allows in my view very nice, possibly well designed scene as long as the terrain becomes not too big.... By working on big terrain (4096 or 2048) became the engine to be unable to save correctly painted surfaces with more than 4 DIFFERENT brushes, and then adding the (eventually shaped) vegetation tool items on this, and adding the navigation, the different models, the scripts, and the animated characters (the point is DIFFERENT ones), and light etc..etc... This ended for me because of performances in a totally disaster ! So well I wonder if this will be realizable in LE5. Because every feature seems good to work tested individually in a small example, I think it is necessery to test all the features together on one big map to see if it stays stable (just as a good game requires) For me could be a test with 1000 (or 200?) high poly DIFFERENT characters/models something interesting - maybe like in the game "Prototype 2": It's incredible how soft the game can be played with all features like cars driving NPC, physics, and many many animated characters ! Because DIFFERENT means too different textures etc I think my ideas run in a no way because of performance crash. Than I got the idea to create the world and everything in a reduced size. This gave good results expect for two points: - NPC default shape becomes too big and so the navigation is ruined - the driving experience is not so good as in "normal" size.
-
Hello ! What about os.time() ? I was able to use this for randomseed() and it compiled good, now comes an error... I tried os:time() but it did not succeed too thx for help/ideas !
-
It just does nothing by clicking select material as here in the picture: (I'm not in beta) - thx Here in the video you can see what happens no loading map possible By the way my complete LE editor seems to be buggy ---> (wtf)? Does anybody else have this ? I just went from beta to normal version and not even File/open fires correctly, it just does nothing/ not react ??? I'm under windows 10-64 I'm happy for help thx !! Edit------------------------------------ SOLUTION was to uninstall / complete reinstall through steam, bug is gone !
-
Great! Any perspective when 4.6 approximately comes out ?
-
Thx yes that is very clear
-
Yes Josh that's right... I got one time the problem with childs using variables defined in the parent start script like this: Child:GetParent().script.variable This "variable" should not be the same if the parent start() function fires first. The same with Global variables defined in the parent start function and that could be used in children start()... BUT I encounter the problem only one time, just after saving my player-character as Prefab, the same map that runs 100x without bugs didn't anymore. This occurs only one time so it's not so heavy for me, I could restore the character from a another map, saving it as prefab without problem. I don't know. Little bit strange.
-
yes ok thx
-
Hello people, I read a lot of people who encountered problems that the start functions of the children would not fire... I encounter today the opposite problem. All my scripts are written like that the main character start function fires at first and then the start() of the children. Now it seems like Leadwerks let run first the children start() functions that return a many errors as my variables are in the main start() declared... That's penible because it seems there is no order control about this ? thx
-
Yes solved
-
I encounter this bug in 4.5 but only on the spline tools example map.
-
No problem... Yes it was the road-options map, but I detected no problem in a "blank" project. So you can run the Terrain map from the FPS template very well...thx
-
I'm not sure but I detected a collision between scene static and debris object with Mass.
-
Okay that's all right but there is more, what about the FPS player ? After some tests it crashes after a few steps only in a map with the Spline tools loaded... ?