-
Posts
41 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by DanceTweety
-
The program I am making is using the physics engine so making a program to follow the ball using SetPosition() and SetRotation() would be us less. Why cant I like Macklebee is saying set the Collision respons becouse it seems to do notthing at the moment.
-
I have try that now Trigger will work it change its Physics Mode from Rigid Body to Character Controller. But then it does not roll off course. When you make object and make that a child of the ball all kinds of strange things happen. I get a giant ball in the scene and it will not detect any way. So seams is no way to get a ball to be detected.
-
No did not change Physics Mode from Rigid Body to Character need it to be ball shaped. This maybe a option I wonder what will happen when I shoot it in a hole though.
-
I have tried making the ball a character instead of a prop allready did not help. Still would not detect it. There must be something in Player prefab that makes it different becouse it is the only thing that is detected.
-
This is how the script in the ball looks it is linked in flowchart editor to out of CollisionTrigger.lua script. Script.score = "0" Script.hit_test1 = false Script.hit_test2 = false function Script:Ball_hit1()--in self.hit_test1 = true if self.hit_test1 == true then self.score = "50" end end --[[function Script:Ball_hit2()--in self.hit_test2 = true end ]]-- function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) if self.hit_test1 == true or self.hit_test2 == true then local context=Context:GetCurrent() context:SetBlendMode(Blend.Alpha) --Set blend to alpha so only letters will show context:DrawText("Score: ".. self.score .."",5,150) --Set text and position of text else local context=Context:GetCurrent() context:SetBlendMode(Blend.Alpha) --Set blend to alpha so only letters will show context:DrawText("Score: ".. self.score .."",5,150) --Set text and position of text end end If I put in Player in the CollisionTrigger.lua script instead of ball it works fine. Also try Name instead of name in CollisionTrigger.lua script but then script did not work any more when I tested it with Player.
-
This is how it is looking now: --[[This script will make any entity act as a collision trigger. It works best when you set the entity's collision type to "Trigger". This will continuously detect collisions without causing any physical reaction. ]]-- function Script:Start() self.enabled=true end function Script:Collision(entity, position, normal, speed) if self.enabled and entity:GetKeyValue("Name") == "ball" then self.component:CallOutputs("Collision") end end function Script:Enable()--in if self.enabled==false then self.enabled=true self:CallOutputs("Enable") end end function Script:Disable()--in if self.enabled then self.enabled=false self:CallOutputs("Disable") end end It does not react on Player what is good but also does not react on ball (this is what the entity is called in the scene). It seem it will not react on a prop. Same happens in the Selective Collision Trigger 1.0 script.
-
I Found out my self that you have to drag the entity in to the box of the script to get it in. It still does not trigger on the ball though.
-
I am trying to make a trigger box to detect a ball using CollisionTrigger.lua. But it only detects the player. How can I change this the ball is a prop and has a phy file. Any help is welcome I also tried the Selective Collision Trigger 1.0 but it does also not detect the ball I also dont see how I can put a Entity in the box and even it I place it in the script it does not show up in the input box.
-
Distribution systems like steam are the future cutting out the middle man this is a good thing. Becouse the middle man makes alot with out doing alot. Also things like greenlight are great for inds.
-
Particle Emitters Visible when Not in Line of Sight
DanceTweety replied to Haydenmango's topic in Suggestion Box
Maybe be you can make a option in the emmiter to say if you want it to be on all the time? -
I like them save me a little time again
-
What I did to have control over the shininess is make a range of shaders for 20% 30% 40% 50% 60% 70% By changing the line "outcolor = mix(outcolor,texture(texture4,cubecoord),0.5); //mix diffuse with cubemap reflection 50%" to that values. Works great
-
See topic: Material editor not working
-
Material editor not working
DanceTweety replied to YouGroove's topic in Leadwerks Engine Bug Reports
I tested on the 3.1 steam indie version to and same error. What happens is that the last texture file you add the meta files are ruined the moment you press save. You all so will see that the meta files are 1k after that. It only happens to the last file you put in the material. I can send you the files if you need them? I hope some one will look at this soon -
I really like Shadermap 2 it is not free but for $39.95 it is alot of program for your buck.
-
Material editor not working
DanceTweety replied to YouGroove's topic in Leadwerks Engine Bug Reports
I seam to have same problem in 3.1 beta steam ind version This are errors I get: Error: Texture file header not found. Failed to load thumbnail 6 for D:/leadwerks/RescueDrYoung/Materials/Metal/brushed_metal_dirty_normal.tex Saving thumbnail D:/leadwerks/RescueDrYoung/Materials/Metal/brushed_metal_dirty_normal.tex -
Reinstalled leadwerks And I have the same error now no matter what texture or shader I use when I try to make a material in the material editor: Error: Texture file header not found. Error: Failed to load texture "D:/leadwerks/RescueDrYoung/Materials/Metal/diamondsteel_spec.tex" Failed to load thumbnail 6 for D:/leadwerks/RescueDrYoung/Materials/Metal/diamondsteel_spec.tex Loading texture "D:/leadwerks/RescueDrYoung/Materials/Metal/diamondsteel_spec.tex..." This looks like a bug in the material editor to me?
-
@DanceTweety : It's perhaps not the shader the problem. Could you try to choose simple shader like normal map and see if the problem is occuring ? (It could be some bug with Material editor) Yes I will reinstall leadwerks just to besure
-
Hi Shadmar, I have edited the diffuse.shader to make it a reflective cubemap shader. But I have a problem every time I put a cubemap file in to the shader it seems like it is changed. It seem to work in material editor till I save it them the cubemap turns drank in the material editor and the cubemap file it self turns dark to. This is how the Vertex part looks: #version 400 #define MAX_INSTANCES 256 //Uniforms //uniform mat4 entitymatrix; uniform vec4 materialcolordiffuse; uniform mat4 projectioncameramatrix; uniform mat4 camerainversematrix; uniform instancematrices { mat4 matrix[MAX_INSTANCES];} entity; //Attributes in vec3 vertex_position; in vec4 vertex_color; in vec2 vertex_texcoords0; in vec3 vertex_normal; in vec3 vertex_binormal; in vec3 vertex_tangent; //Outputs out vec4 ex_color; out vec2 ex_texcoords0; out float ex_selectionstate; out vec3 ex_VertexCameraPosition; out vec3 ex_normal; out vec3 ex_tangent; out vec3 ex_binormal; out vec4 ex_vertexposition; void main() { mat4 entitymatrix = entity.matrix[gl_InstanceID]; mat4 entitymatrix_=entitymatrix; entitymatrix_[0][3]=0.0; entitymatrix_[1][3]=0.0; entitymatrix_[2][3]=0.0; entitymatrix_[3][3]=1.0; vec4 modelvertexposition = entitymatrix_ * vec4(vertex_position,1.0); ex_VertexCameraPosition = vec3(camerainversematrix * modelvertexposition); gl_Position = projectioncameramatrix * modelvertexposition; ex_vertexposition = modelvertexposition; //we need this position the fragment shader mat3 nmat = mat3(camerainversematrix);//[0].xyz,camerainversematrix[1].xyz,camerainversematrix[2].xyz);//39 nmat = nmat * mat3(entitymatrix[0].xyz,entitymatrix[1].xyz,entitymatrix[2].xyz);//40 ex_normal = normalize(nmat * vertex_normal); ex_tangent = normalize(nmat * vertex_tangent); ex_binormal = normalize(nmat * vertex_binormal); ex_texcoords0 = vertex_texcoords0; ex_color = vec4(entitymatrix[0][3],entitymatrix[1][3],entitymatrix[2][3],entitymatrix[3][3]); //If an object is selected, 10 is subtracted from the alpha color. //This is a bit of a hack that packs a per-object boolean into the alpha value. ex_selectionstate = 0.0; if (ex_color.a<-5.0) { ex_color.a += 10.0; ex_selectionstate = 1.0; } ex_color *= vec4(1.0-vertex_color.r,1.0-vertex_color.g,1.0-vertex_color.b,vertex_color.a) * materialcolordiffuse; } This is how the Fragment part looks: #version 400 #define BFN_ENABLED 1 //Uniforms uniform sampler2D texture0;//diffuse map uniform samplerCube texture15;//BFN map uniform vec4 materialcolorspecular; uniform vec4 lighting_ambient; uniform samplerCube texture4; //cube map for reflection texture from material uniform mat3 cameranormalmatrix; //need normalmatrix from camera for correct reflection in relation to camera rotation uniform vec3 cameraposition; //need camera position so we know the distance from the fragment. (pixel) //Lighting uniform vec3 lightdirection[4]; uniform vec4 lightcolor[4]; uniform vec4 lightposition[4]; uniform float lightrange[4]; uniform vec3 lightingcenter[4]; uniform vec2 lightingconeanglescos[4]; uniform vec4 lightspecular[4]; //Inputs in vec2 ex_texcoords0; in vec4 ex_color; in float ex_selectionstate; in vec3 ex_VertexCameraPosition; in vec3 ex_normal; in vec3 ex_tangent; in vec3 ex_binormal; in vec4 ex_vertexposition; out vec4 fragData0; out vec4 fragData1; out vec4 fragData2; out vec4 fragData3; void main(void) { vec4 outcolor = ex_color; vec4 color_specular = materialcolorspecular; vec3 normal = ex_normal; //Modulate blend with diffuse map outcolor *= texture(texture0,ex_texcoords0); vec3 cubecoord = reflect( normalize( ex_vertexposition.xyz - cameraposition ) , normalize(cameranormalmatrix * normal).xyz ); //this is industy standard cubecoordinates for reflection.. outcolor = mix(outcolor,texture(texture4,cubecoord),0.5); //mix diffuse with cubemap reflection 50% //Blend with selection color if selected fragData0 = outcolor;// * (1.0-ex_selectionstate) + ex_selectionstate * (outcolor*0.5+vec4(0.5,0.0,0.0,0.0)); #if BFN_ENABLED==1 //Best-fit normals fragData1 = texture(texture15,normalize(vec3(normal.x,-normal.y,normal.z))); #else //Low-res normals fragData1 = vec4(normalize(normal)*0.5+0.5,1.0); #endif fragData1.a = materialcolorspecular.r * 0.299 + materialcolorspecular.g * 0.587 + materialcolorspecular.b * 0.114; int materialflags=1; if (ex_selectionstate>0.0) materialflags += 2; fragData2 = vec4(0.0,0.0,0.0,materialflags/255.0); } Maybe I did something wrong? b.t.w I use 3.1 indi version
-
Thanks for people that try to help. Was not much that worked but I figured it out my self in the end. This is how the code looks right now handy to know maybe for others: Script.enabled = true --bool "Enabled" Script.gravity = false --bool "Gravity" Script.movespeed = 1 --Define self.movespeed Script.originPosition = nil --Define self.originPosition Script.currentPosition = nil --Define self.currentPosition Script.oldMass = nil --Define self.oldMass Script.window = Window:GetCurrent() --Define self.window Script.move = Vec3(0,0,0) --Define self.move Script.rotation = "" --Define self.rotation Script.ry = 0 --Define self.ry Script.speed = "" --Define self.speed function Script:Start() self.originPosition = self.entity:GetPosition() --Get position of object self.oldMass = self.entity:GetMass() --Get mass of object if self.entity:GetShadowMode()>0 then self.entity:SetShadowMode(2)--Light.Dynamic end if self.enabled then if self.entity:GetMass() == 0 then --Get mass and check if bigger then 0 Debug:Error("Entity mass must be greater than zero.") end else self.entity:SetMass(0) end self.entity:SetGravityMode(self.gravity) --Set gravity to false self.entity:SetFriction(0,1) --Set Friction self.move = Vec3(0,0,0) --Set self.move to vector end function Script:UpdatePhysics() --Loop to update Physics self.move = Vec3(0,0,0) local movespeed = self.movespeed --Set movespeed to self.movespeed self.rotation = self.entity:GetRotation():ToString() --Set self.rotation and make it a string (else it is userdata and will not work) self.ry = string.sub(self.rotation,11,15) --Set self.ry with y of rotation (if cuts of x and z) self.ry = tonumber(self.ry) --Set self.ry to be a number self.ry = math.ceil(self.ry) --Set self.ry to be a round number local inRadians = math.rad(self.ry) --Convert degrees to radians if (self.window:KeyDown(Key.Up)) then self.move.x = -1 * movespeed * math.cos(inRadians) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Up)) then self.move.z = movespeed * math.sin(inRadians) * Time:GetSpeed() end --Look if upper arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Down)) then self.move.x = movespeed * math.cos(inRadians) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.x (x-axis) if (self.window:KeyDown(Key.Down)) then self.move.z = -1 * movespeed * math.sin(inRadians) * Time:GetSpeed() end --Look if lower arrow key is pressed and Set value in selfmove.z (z-axis) if (self.window:KeyDown(Key.Right)) then self.move.y= movespeed * Time:GetSpeed() end --Look if right arrow key is pressed and Set value in selfmove.y (y-axis rotation) if (self.window:KeyDown(Key.Left)) then self.move.y= -1 * movespeed * Time:GetSpeed() end --Look if left arrow key is pressed and Set value in selfmove.y (y-axis rotation) self.entity:AddForce(self.move.x,0,0) --AddForce with the self.move.x value on x-axis self.entity:AddForce(0,0,self.move.z) --AddForce with the self.move.z value on z-axis self.entity:AddTorque(0,self.move.y*70,0) --AddTorque with the self.move.y value on y-axis (rotation) Time:Update() --Update Time value end function Script:PostRender() --Function to print on game screen local context=Context:GetCurrent() context:SetBlendMode(Blend.Alpha) --Set blend to alpha so only letters will show context:DrawText("Rotation :".. self.ry .."",5,130) --Set text and position of text --context:DrawText("Speed :".. self.speed .."",5,140) --Set text and position of text end
-
I did that to. Was one of the first things I tried. But the motor simply takes of even though it is in boat in the scene tab. That is why I tried the script with the hinge you see at top of this post.
-
This is the example of how to do it but it is using a child box make in the script it self. I want to us the child box as a motor so need a box where a can put the motor script in. So how would I us a allready existing box in the Parenting script? self.entity = Model:Box() local child = Model:Box(1,1,1) child:SetParent(self.entity) child:SetColor(1.0,0.0,0.0) child:SetPosition(2,-2,0) child = Model:Box(1,1,1) child:SetParent(self.entity) child:SetColor(0.0,1.0,0.0) child:SetPosition(-2,-2,0) return true
-
Ok I will look how I have to put SetParent in my first script and hope it will work then.
-
Ok I will try to find out how to make parent and child in leadwerks. Thanks for the help so far.