TheConceptBoy Posted June 12, 2019 Share Posted June 12, 2019 Just now, wadaltmon said: I don't think that's it. If I set the character model to be taller, remove the outer cylinder, and make it so the held object can collide with Characters, it does the same thing with the character model itself. And yes @TheConceptBoy: If we had that in C++ in an extensible form, this would be a non-issue. I'm guessing my ball join solution was no bueno right? Quote Link to comment Share on other sites More sharing options...
wadaltmon Posted June 12, 2019 Author Share Posted June 12, 2019 4 minutes ago, TheConceptBoy said: I'm guessing my ball join solution was no bueno right? It worked, but it didn't really fix the magic carpet problem. Certainly made it more forgiving like you said, but still possible. Also the slow and random way your held object moved toward the mouse was not quite what I was looking for. Definitely a good solution, but as far as what I want to accomplish in the final game, not quite the type. That said, the quality of the tutorial was still top notch. 1 Quote Link to comment Share on other sites More sharing options...
wadaltmon Posted June 13, 2019 Author Share Posted June 13, 2019 Would anyone know how to make an object move faster toward a Ball joint? It moves very slowly toward the ball joint that gets attached to the object. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 13, 2019 Share Posted June 13, 2019 As in when using SetTargetPosition()? I found using a very low mass made it accelerate and de-accelerate a lot faster. Quote Link to comment Share on other sites More sharing options...
wadaltmon Posted June 13, 2019 Author Share Posted June 13, 2019 25 minutes ago, Lethal Raptor Games said: As in when using SetTargetPosition()? I found using a very low mass made it accelerate and de-accelerate a lot faster. How low are you talking? My masses are at 0.5. Perhaps setting the friction of the joint could work? 23 hours ago, TheConceptBoy said: There's a video for leadwerks on moving objects using the Editor. We need THAT same thing but in C++ Righto! I ported this code to C++, exactly what I needed. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 13, 2019 Share Posted June 13, 2019 4 minutes ago, wadaltmon said: How low are you talking? My masses are at 0.5. Perhaps setting the friction of the joint could work? Yeah I set mine to 0.1 but it wasn't perfect. Lowering the friction of the kinematic joint changes how it effects the rotation and position of it's child. Quote Link to comment Share on other sites More sharing options...
wadaltmon Posted June 14, 2019 Author Share Posted June 14, 2019 On 6/9/2019 at 5:23 PM, havenphillip said: Maybe you could create a box around the player and use this Enter/Exit code from Aggror? But set it for Collision.Prop or whatever in an "if" statement? Script.enabled = true Script.entered = false Script.exited = false Script.collided = false function Script:UpdatePhysics() if self.enabled then if self.entered then if self.collided == false then System:Print("Exited the trigger") self.exited = true self.entered = false end end self.collided = false end end function Script:Collision(entity, position, normal, speed) if self.enabled then self.collided = true if self.entered == false then System:Print("Entered the trigger") self.entered = true self.exited = false end end end So I'm a little fuzzy on how Lua functions, but when I was porting the carry objects Lua scripts, I saw a function like this Collision function. So if you write a function Script:Collision(entity, position, normal, speed), it's called whenever a collision happens with a given entity? How would I go about creating/using such a function in C++? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 14, 2019 Share Posted June 14, 2019 What you'll need is an Actor in C++. The script is basically an Actor (but in LUA) that attaches to an Entity. An Actor is a class in C++ that attaches to an Entity. Look in the Actor.h and Actor.cpp files for Leadwerks. You derive from the Actor class like this. I named mine cBaseActor, but you can name it anything you like. class cBaseActor : public Actor { private: public: cBaseActor(); ~cBaseActor(); //reDeclare the functions found in Actor.h, create a BaseActor.cpp and define your functions there like in the script void Attach(); virtual void UpdateWorld(); virtual void UpdatePhysics(); virtual void Collision(Entity* ent, const Vec3& position, const Vec3& normal, float speed); virtual void UpdateMatrix(); virtual void PostRender(Context* context); } cBasActor* _actor = new cBaseActor(); myEntity->SetActor(_actor); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.