Jump to content

Charrua

Supporters
  • Content Count

    213
  • Joined

  • Last visited

Everything posted by Charrua

  1. Hi Alien, I'm also somewhat lost.. going back, nice to hear about you.
  2. Yes, so excited to see it almost finished. Guess next month will be installed and working... And perhaps I'll see some money
  3. Not yet, but, if the project continues, it should be a next step or something to take into consideration. A 360 degrees detection system should be possible, but, more complex and expensive
  4. He he, me too! This video is of a couple of years when we build the demonstration prototype. test4.mp4
  5. It's more hardware than software, leadwerks part is to have something to shoot :). Guns have infrared lasers, a camera system detects where the gun is in the screen, then with some maths to translate corrds to leadwerks, a camera pick, and that's it. Simply put. Electronics simulate the gun behavior, and as you will see, I'm not an expert RECORTAR_20190410_105041.mp4 RECORTAR_20190410_104628.mp4
  6. drives were mounted but as ro, did a mount -o remount rw / then nano .xsessionrc delete the "shutdown..." line and voila... all is working again thank you very much
  7. well, now I have another problem, my bad i placed a shutdown line after gedit, to test if the systems shotsdown after gedit, and found that the system start and shutdown (no gedit) is there a way of intercept startup and open a terminal so I can delete the .xsession file? thanks
  8. well, if i place a .xsessionrc file with: then ubuntu starts, exec gedit and gedit open the pj01.sh file located in the above directory but if, instead of gedit i place ./pj01.sh then LE app do not start
  9. Thanks, I'll try it as soon as I get home.
  10. the thing now is how or from where I execute this script, because if i launch it from .config/autostart it start the leadwerks app, but do not shutdown the system my idea was that turning on the PC the app autostart and when quitting it, the system shutdown Is there other way to autostart an app?
  11. Ah, ok! yes, now, it shutdown if i run it from a terminal not if I use the .desktop shortcut this is the pj01.sh now
  12. thanks, but nope if i open a terminal and execute the pj01.sh script, the leadwerks app starts ok, and after it, simply the terminal again last line of leadwerks throws : AL lib: (EE) alc_cleanup: 1 device not closed then, the propmt. (and, no other command on the script seems to be executed)
  13. i placed a "ls" instead a shotdown, but nothing is executed after the leadwerks app
  14. thanks for answer i have this file in .config/autostart also works with: and the pj01.sh is: i write the line after exec, but after pj01 ends, system do not shoot down if I open a terminal, shutdown -h now, works ok i try other combinations but, due to my lack of knowledge on the subject... i somewhat lost and with the !bin/bash Juan
  15. Hi, it's been a long time from my last post here I'm finishing a Leadwerks program on ubuntu 16.04, not a game, is a 3d graphical interface for a "Shoot simulator" with real (modified) guns. I'm so novice with linux, so after some reading i got the application run at startup. This application is the only one which will run on this pc, so it should start at startup and the system should shootdown when quitting from the application. (after try and pray many times... ) Basically i end placing a .desktop file in .config\autostart directory with a exec command to the leadwerks script to run the project file, so simple once one get to know how I guess that, i can place a shootdown command on the launch script, but I did not find the way, all my readings point to: shootdown -h now (edit: i mean.. shutdown not shootdown) but, i guess i'm not doing, writting, placing it in the correct way. Some linux expert here? Thank's in advance Juan
  16. i do like the way the cars behave at low speed with leadwerks physics, but, as speed rises it shakes so much, so for omega i was using something like: self.entity:SetOmega(omega.x/(1+2*currentSpeed/maxSpeed),omega.y/(1+currentSpeed/maxSpeed),omega.z/(1+2*currentSpeed/maxSpeed)) this way, i use the omega practically unaltered at low speed and then as speed rises and goes near maxSpeed, the x,y,z components are modulated playing with the 1+2* or 1+1* or 1+5* i get more or less attenuation on desired axes. I do not play with your car, stiil, I will for sure, in the video it looks and behaves very well, but so much rigid at low speed (for me ) the x5 is still in my mind.. will try, thank´s for sharing all this stuff
  17. self.Tires[n]:SetOmega(self.Tires[n]:GetOmega()*Vec3(5,5,5)) --------- make the car go faster very smart! --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 too much tuning on all of this constants... very nice!
  18. Charrua

    Simple Car Improved

    Sphere is placed by math at the center of the 4 wheels, so, as you say, any shape is ok. The camera uses the orientation of the real chassis, for that reason it has this strange behavior. I still use a 100 mass car, an strength is scaled as speed rise. The chassis hits the ground and has 0 friction, I guess is better to hide it and let the fake chassis look nice and slow, perhaps I reduce the movement using some average values to reflect or simulate a more realistic one...
  19. Charrua

    Simple Car Improved

    About krazy tests... video captures are so glitchy, i guess is the combination of leadwerks and the video capture sofware.. There are 4 lines of text, the first two are what is the speed aplied to the wheels and so, the estimates speed, based on diameter*PI in m/s and km/s The last two lines are based on real distance travelled (taking chassis positions each second and calclating distance, with vec3 distance to point function) I placed the chassis underground and it behaves ok, but beaware of not jump! The white sphere (is a fake chassis) is placed by hand doing an average of the position of the 4 wheels. testCar body under floor seen.avi if you set the property Hidden on the editor, then jumps are ok but, behavior is not much as realistic as it should, when you stop, the chassis seems to do a pendulus movement.. testCar body under floor hiden.mp4 now, the following two test are with the cassis in the correct place, seen/not seen. When chassis is correctly placed, as marcosuik says it tends to touch the floor and seems to try to fly I am using strength scaled (increased) by car speed. testCar body avobe seen.avi testCar body avobe hidden.avi Juan
  20. Charrua

    Simple Car Improved

    Thanks, I will try it, I was applying scaled strength based on speed in my last (not published still) tests.. Also doing not so logical tests :), but with good resultsresults
  21. Now, I wrote a single script that creates suspension, steer and traction You have to create the chassis, 4 wheels, set this script to each one of the wheels and then paly with the configurable parameters. Enjoy: --[[ Autor Juan Ignacio Odriozola (charrua) Purpose: A script that facilitates the making of a simple car all you need is a chassis and 4 wheels assing this scrip to each wheel and set the object chassis then adjust some of the configurable parameters Parent: chassis entity : wheel 3 joints and 2 auxiliary entities are created the chain is: Parent Slider Pivot Hinge Pivot Hinge chassis -suspensionJoint- suspensionPivot -steerJoint- steerPivot -wheelJoint- wheel suspension uses pin 010 (Y axis) steer uses pin 010 (Y axis) wheel pin (must be set depends of wheel orientation) up/down keys are defaults for forward and backward left/right keys are defaults for steer left/right space key is default for brakes steer velocity and start/end angle must be set suspension lenght must be set wheel friction must be set steerAngle set both limits to +/- steerAngle/2 if no key (left/right) is pressed then, target angle is 0 : straight suspensionLenght set both limits to +/- suspensionLength/2 and target distance is set to 0 suspension strength defaults to 1000 which is too much strenght for a light weight car (20 of mass) and not to much for a 200 car of mass each joint is created with a mass of 1, which should be taking into accoung (so for a 4 wheels car, you have a mass of 8 on the 8 joints). there are so many other parameters that may be adjusted: Spring, Strength, Stiffness ... not too much documented :) ]]-- Script.currspeed = 0 Script.chassis = nil--Entity "chassis" Script.pin = Vec3(0,0,1) --Vec3 "wheel Pin" Script.motorspeed=500--float "max motor speed" Script.velcontrolled=false--bool "velControl" Script.suspensionLength=0.2--float "suspension" Script.steerAngle=90--float "steer angle" Script.steerSpeed=100--float "steer velocity" Script.friction=1--float "wheel friction" Script.steerPivot=nil Script.suspensionPivot=nil Script.steerJoint=nil Script.suspensionJoint=nil Script.wheelJoint=nil function Script:Start() local pos = self.entity:GetPosition(false) --true for global if self.chassis ~= nil then self.suspensionPivot = Pivot:Create() self.suspensionPivot:SetPosition(pos) self.suspensionPivot:SetMass(1) self.suspensionPivot:SetCollisionType(Collision.None) self.steerPivot = Pivot:Create() self.steerPivot:SetPosition(pos) self.steerPivot:SetMass(1) self.steerPivot:SetCollisionType(Collision.None) --joints creation self.suspensionJoint = Joint:Slider(pos.x, pos.y, pos.z, 0, 1, 0, self.chassis, self.suspensionPivot) self.steerJoint = Joint:Hinge(pos.x, pos.y, pos.z, 0, -1, 0, self.suspensionPivot, self.steerPivot) self.wheelJoint = Joint:Hinge(pos.x, pos.y, pos.z, self.pin.x, self.pin.y, self.pin.z, self.steerPivot, self.entity) --suspension self.suspensionJoint:EnableLimits() self.suspensionJoint:SetLimits(-self.suspensionLength/2,self.suspensionLength/2) --steerAngle=0 means no steer self.suspensionJoint:SetTargetAngle(0) --at the middle self.suspensionJoint:SetMotorSpeed(1) -- 1 m/s self.suspensionJoint:SetStrength(100) --defatul is 1000 self.suspensionJoint:EnableMotor() --steer self.steerJoint:EnableLimits() self.steerJoint:SetLimits(-self.steerAngle/2,self.steerAngle/2) --steerAngle=0 means no steer self.steerJoint:SetMotorSpeed(self.steerSpeed) self.steerJoint:EnableMotor() --wheel self.entity:SetFriction(self.friction, self.friction) else Debug:Error("no chassis assigned") end end function Script:setMotorSpeed(speed) if self.velcontrolled then --System:Print("setMotorSpeed: "..speed) self.currspeed = speed if speed~=0 then self.wheelJoint:EnableMotor() end self.wheelJoint:SetMotorSpeed(self.currspeed) end end function Script:UpdateWorld() if self.motorspeed>0 then self.wheelJoint:SetAngle(self.wheelJoint:GetAngle()+100) else self.wheelJoint:SetAngle(self.wheelJoint:GetAngle()-100) end if App.window:KeyDown(Key.Space) then self:setMotorSpeed(0) end if self.velcontrolled then 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 end if self.steerAngle>0 then local direction=0 if App.window:KeyDown(Key.Left) then direction=-self.steerAngle/2 end if App.window:KeyDown(Key.Right) then direction=self.steerAngle/2 end self.steerJoint:SetAngle(direction) else self.steerJoint:SetAngle(0) end end In the other maps i was using a box as a floor to which I set the desired friction, testing this new script i use a terrain and have to figure it out how to set the friction to the terrain... Did some searches and ended with: local n for n=0,self.world:CountEntities()-1 do local entity = self.world:GetEntity(n) if entity:GetClassName()=="Terrain" then terrain = entity System:Print("terrain found!") terrain:SetFriction(10,10) break end end insert this in the app.lua (after load map) and then you can play with terrain friction, the video shows how the car behaves with the defaul terrain friction and then whit a friction of 10,10 Always learning something new A word about some parameters: If you are using a hinge, when you specity speed (SetMotorSpeed) the number means degrees per second. So if you use 3600 as max speed you get 10 revoluions per second. If your tire has, 64cm then d*pi aprox 2 meters per revolution, 10 revolutions per secon aprox 20 meters per second... and if you are lucky 72Km/h If you are using a slider, then speed is un meters per second. Other parameter which is very important is the hinge/slider "pin" which is a vector that tells the direction of movement of the slider or over which plane de hinges open/close For a common door, we need to use the Y axis, so the pin is 0,1,0 I use this pin for the suspension and for the steer but for this script, you must tell the traction pin, which sould be 1,0,0 or 0,0,1 depending on the orientation of your tires If your tires are not facing X nor Z axis, then you have to do some math to get the proper x,z component of the pin In the script I use a Strenght of 100, instead of the 1000 which is default, my car is light weight : 5 + 4*3 = 17 of Mass chassis has 5, each wheel has 1 and the 2 auxiliary pivots has 1 each one whith a friction of 10 on each tire and with a friction of 10 on the terrain looks ok for me (better than I spected at first). Juan
  22. Charrua

    Joints

    If you get lost, you may PM me in spanish, but I do prefere to continue the therad in english, so, it keeps being usefull for the rest of the members. As you may know from my username, I'm from Uruguay, Montevideo, the southest Capital of South America Charruas was the ones that habit these lands before european came. Juan
×
×
  • Create New...