Einlander
-
Posts
778 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Einlander
-
-
Think interpolation, As you get farther from an entity or have a certain amount of entities on screen you reduce the amount of animation steps you actually Process.
Look at the Creatures in the background. The animation is in sync but the number of animation frames processed is reduced.
-
You're right, I didn't see when you used the Time:GetSpeed. So you have basically all bases covered.
-
The default character controller is programmed to update on physics instead of on world. This gives it constant motion that is independent of fps. On leadwerks the physics is already time adjusted. Your version will start to misbehave on very high or low fps. This becomes a concern when you have to do something within a set time. If fps is low the time will run out before your done, if its high you will be done before the time runs out.
-
So I worked on this some more and ran into a few issues and some questions. Can sprites cast shadows? If no then it will cause problems with immersion. For example power lines outside in the day. I would expect those to have shadows. Next is you can't attach joint's to a mesh without bones as far as I know. So since we are generating the rope on the fly this is a no go. Finally slack in a rope. You can define the number of control points and how much slack they have from the next point. This is done by offsetting the control points by the slack amount on the z axis. This is a recipe for disaster.
My solution that I'm going explore something that I found n some unity forums. They simply create a mesh with vertexes at each joint location and deform it to match the joints location as it moves.
I have some family business to attend to so the next presentation may take a while.
- 1
-
Good post, I was completely lost with the sprite part. I'll experiment with something additional too.
-
Here's what a night of no sleep accomplishes.
So this is an almost complete dynamic rope creation system. You create 2 pivots, one start, one end. You attach this script to the start and drop the end entity on the end point box. It will then string joints between the 2 points. You can set the amount of slack there is in the rope.
To make it hang from the ceiling like a gymnasium rope or a broken power-line, just add mass to 1 of the ends.
There is a debug mode that will show the actual pivot/joint locations. The start is green and the end is blue. The rope goes from black to red as it reaches the end.
WHAT NEEDS TO BE DONE:
Sprites need to be added to make it look like an actual rope. The rope is invisible when not in debug mode so not much use yet...
--[[ Dynamic Rope Alpha By Einlander Description: Creates a rope between 2 points Instructions: Create 2 pivots, attach this script to the start, and drop the end on the End point box, adjust settings and go. TODO: Add sprites to actually draw the rope. ]]-- Script.EndEntity = nil -- entity "End Point" Script.Sections = 8 -- int "Sections" Script.Mass = 5 -- float "Mass" Script.Slack = 0 -- float "Slack" Script.Debug = false -- bool "Debug Mode" Script.Info = 0 --choice "Info" "Dynamic Rope Alpha,VERSION .01, By Einlander" function Script:Start() if self.EndEntity == nil then Debug:Error("End Point Entity Empty") end if self.Sections < 2 then Debug:Error("Sections must be 2 or greater") end -- Create boxes at start and finish if self.Debug == true then self.startpoint = Model:Sphere(3,self.entity) self.startpoint:SetScale(.1,.1,.1) self.startpoint:SetColor(0,1,0) self.endpoint = Model:Box(self.EndEntity) self.endpoint:SetScale(.1,.1,.1) self.endpoint:SetColor(0,0,1) else self.startpoint = Pivot:Create(self.entity) self.endpoint = Pivot:Create(self.EndEntity) end start1 = self.entity:GetPosition(true) end1 = self.EndEntity:GetPosition(true) -- place midpoints local i self.midpoints = {} local midpoint = self.entity table.insert(self.midpoints, midpoint) self.joints= {} for i = 1, self.Sections do if self.Debug == true then print(i/self.Sections) end -- Math formula from --http://stackoverflow.com/questions/2886092/finding-coordinates-of-a-point-between-two-points --https://archive.is/ME00H [ archive just in case] result = Vec3() result.x = (start1.x + (i/(self.Sections)) *(end1.x - start1.x)) result.y = (start1.y + (i/(self.Sections)) *(end1.y - start1.y)) if (i~= self.Sections) then if self:IsEven(i) == true then result.y = result.y + self.Slack else result.y = result.y + (self.Slack * -1 ) end end result.z = (start1.z + (i/(self.Sections)) *(end1.z - start1.z)) if self.Debug == true then local midpoint = Model:Box() midpoint:SetScale(.1,.1,.1) midpoint:SetColor((i/(self.Sections)),0,0) midpoint:SetPosition((result),true) midpoint:SetMass(self.Mass) table.insert(self.midpoints, midpoint) else local midpoint = Pivot:Create() midpoint:SetPosition((result),true) midpoint:SetMass(self.Mass) table.insert(self.midpoints, midpoint) end end local midpoint2 = self.EndEntity table.insert(self.midpoints, midpoint2) --set joint physics --start anchor local temppos = self.midpoints[1]:GetPosition(true) local tempjoint = Joint:Ball(temppos.x,temppos.y,temppos.z,self.midpoints[2] ,self.midpoints[1]) tempjoint:DisableLimits() table.insert(self.joints, tempjoint) --middle points for i = 2, #self.midpoints do local temppos = self.midpoints[i-1]:GetPosition(true) local tempjoint = Joint:Ball(temppos.x,temppos.y,temppos.z, self.midpoints, self.midpoints[i-1]) tempjoint:DisableLimits() table.insert(self.joints, tempjoint) end --end anchor local temppos = self.midpoints[#self.midpoints]:GetPosition(true) local tempjoint = Joint:Ball(temppos.x,temppos.y,temppos.z, self.midpoints[#self.midpoints],self.midpoints[#self.midpoints]) tempjoint:DisableLimits() table.insert(self.joints, tempjoint) end function Script:IsEven(number) if (number % 2 == 0) then return true end return false end
- 3
-
I'll see if I can extract my platform code to be standalone. It's not physics based.
-
Get a texture with text so you can read, and add a normal map. Scale it up then run the game. the texture is mirrored and the normal map is not at the same scale but larger.
Image:
-
You simply can not use a regular dll for lua. It must be built for lua http://lua-users.org/wiki/CreatingBinaryExtensionModules and http://lua-users.org/wiki/CreatingBinaryExtensionModules . If you really want to use a dll, there are probably ways to do it, but all of them are non trivial. I recommend luajit because leadwerks supports that. http://luajit.org/ext_ffi_tutorial.html
Quick and dirty:
local ffi = require( 'ffi' )
ffi.cdef [[
int GetSystemMetrics(int test);
]]
local user32 = ffi.load(ffi.os == "Windows" and "user32" )
error("Screen Dimensions " .. tostring(user32.GetSystemMetrics(0)) .. "x" .. tostring(user32.GetSystemMetrics(1)))
You will be searching through header files.
-
I had one that every few cycles sets the physics positions. This forces the physics to update when you want it.
-
That looks like a polymesh collision. Those don't move.
- 1
-
I want to take a physics file and apply it to another model. I would request it be added to the Model editors physics menu option.
My use case scenario:
I have a open box. Players can place objects into it. NOW is where everthing goes to hell. The player now should be able to carry this box. Polymesh is out of the running because those cant move, all of the other options other decomposition makes closed shells, and decomposition cant handle concave shapes well. You can no longer save csg as a physics shape. This leaves a handmade shape. You can add physics shapes to the model in a 3d editor but in game this will remove your ability to interact with the entity. So you have to be able to create a physics shape externally. This is no longer possible in the current incarnation of Leadwerks. To solve this I have to do an end run around the ENTIRE phyics system to do a simple task.
Current process:
Create mesh fbx, export.
Create physics fbx, export (these are 2 separate ).
In Leadwerks load the physics fbx.
Open explorer window and find the collision phy.
Rename collision phy to the mesh phy
This use to be in Leadwerks, it's in the legacy options but there needs to be a way to do this in the new beta and going forward. The engine should not be removing features, it should be refining them. Things it doesn't need should be hid in a menu option because someone somewhere was using it .
- 1
-
Also context scaling breaks some of the 2d draw commands
-
http://www.leadwerks.com/werkspace/page/api-reference/_/font/fontload-r43
Font:Load("Fonts/arial.ttf",36)
- 1
-
Don't worry, I had to search for it too.
-
http://www.leadwerks.com/werkspace/topic/10766-solved-flowgraph-arguments/
and since the actual documentation needed for arguments is missing, here is a backup https://archive.is/6puJx
- 2
-
Isint there an eye dropper tool in the toolbox for this?
-
@ReepBlue by any chance are you using your shader that mixes 2 textures together? Try it with the a built in shader to see what your performance is. Texture changing can get very expensive.
-
If we could get static to update at around 1 to 5 fps... Static shadows really shouldn't be moving.
-
My biggest problem is the massive fps drop that Leadwerks has. One more day runs at a good 4 - 15 fps on my computer, my game was RUTHLESSLY optimized so that the lights wouldn't kill the fps. Any time I want to add a light, I have to think do I really want that there. There can never be more than 4 lights on, and the Directional light will cripple my game play, YET I can run Dying Light at 60fps, all Source games except Cs:Go in excess of 100 FPS. There are some optimizations to be had. If we could work on the engines rendering above all else, I would be happy.
-A Frustrated AMD R9 270x 4gb Crossfire user.
- 2
-
I'm in the same position as be06. I would like to be able to use some of the Leadwerks read functions in the lua sandbox. If FileSystem:ReadFile and Stream:ReadString() was available in sandbox, I would have the PERFECT work around for loadfile.
-
At the top of Script:UpdatePhysics() add
self.entity:AddForce(0,10,0)
This will make you float as if gravity was reversed. Play with it to get the right number for your game. Using the mass generally works fine.
For your jumping you will need to do a bit more work. You have to make sure that you are touching the ceiling (raycast up to make sure it's there), you need to cancel the airborne check, you need to set the jumpforce to -1 and manually push the player.
self.entity:AddForce(0,(mass * jumpforce ) *-1,0)
This is a good place to start.
Also, you may want to rotate the camera on the z axis by 180, and reverse the mouse look controls (multiplying the result by -1 usually reverses it.)
Now the hard part. Your arms and weapons need to be rotated too. Also if you are able to carry things
Start with walking
Then Jumping.
Carrying seems to work fine.
Then weapons and arms.
-
It might help if you asked the question in the other thread so people can see exactly what you are trying to do. So let me try to understand. You want to specify a start and end point. Then you want to have joints automatically generated in between?
So wouldn't you specify the start point and then end point, then divide the distance between them by the number of ball joints you need. The first ball joint would be the child of the start point, the second would be the child of the first and parent of the third and so on. when you get to the last one you assign that to be the parent of the end point.
I would do some pseudo -code, but I haven't slept in a while....
- 1
-
multiply the dir by how far you want it to reach in meters
local dir = Transform:Normal(0,0,0.5,self.player.camera,nil) * distanceInMeters
- 1
What are you working on :
in Showcase
Posted
Adding Specular Color and Gloss Maps to shaders to accomadate the new 3dcoat texture exports.