-
Posts
2,411 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Posts posted by SpiderPig
-
-
Joint* heldObjectJoint = nullptr; if (gameWindow->MouseHit(1)) { if (heldObject == NULL) { Vec3 p = Vec3(gameWindow->GetWidth() / 2, gameWindow->GetHeight() / 2, 0); if (cam->Pick(p.x, p.y, pickinfo, 0, true)) { if ((pickinfo.entity->mass <= 0.6) && (pickinfo.entity->mass > 0.0) && (heldObject == NULL) && (pickinfo.entity->GetDistance(playerDummy->GetPosition(true)) < 2)) { System::Print(true); heldObject = pickinfo.entity; heldObjectJoint = Joint::Kinematic(0.0f, 0.0f, 0.0f, heldObject); } else { System::Print(false); } } } else { heldObject->SetGravityMode(true); heldObject = NULL; } } if (heldObject != NULL) { heldObjectJoint->SetTargetPosition(carryPivot->GetPosition(true)); }
You could try this, not sure how removing the joint would go but you could play around with it a bit.
-
I think what you might need is the kinematic joint, where you can use joint->SetTargetPositon(carryPivot->GetPosition(true)). I will still react with physics i believe.
-
For(int id=0;id <spriteSequences.size ();id++)
{
SpriteSequences[id]->Release ();
}
SpriteSequence.clear () \\resets the list to 0 size
-
AABB::Grow() and AABB::Shrink() commands would be useful.
-
Quote
std::list<Entity> spawnPosition;
Probably should be;
Quotestd::list<Entity*> spawnPosition;
-
Want I want is exactly what you have done with your character controller, but align to different gravity directions. What I'm doing to try and achieve it is this;
- Create Capsule Shape
- Apply constant force of gravity
-
On Actor::Collision();
- Store collision point and normal
- Store collision time
- Turn off gravity
- Set Velocity to 0
-
On UserInput to move;
- Create Plane with the normal and position
- Use angle of character to find a point exactly 1 unit away
- Intersect the plane with a ray aligned with gravity at that move point
- Move capsule with SetVelocity() or PhysicsSetPosition()
-
In Actor::UpdateWorld();
- Use PhysicsSetRotation() to align the capsule with gravity
- Speed = GetVelocity().Length()
- If speed is not 0 and the collision time is greater than 100ms ago, enable gravity.
Using a kinematic joint has the same problems as above but with the addition of slowly rotating to align with gravity and not being snappy when moving to the target unless mass is really really low.
I've also tried, setting the collision response off for the capsule and finding all entities in the AABB around the capsule, and ray casting each shape to find the collision point. This work smoothly and was great except FPS dropped from 100 to 70 (just with one Pick per frame as it was moving) so this was not ideal. The fact that this worked told me that the problem lies with the capsule still colliding with the ground as I move it.
I think what I want can only be done under the hood with newton commands.
-
Ah okay. But it will still flex around when it is hit, which isn't ideal for a character controller.
-
Ah I see what you mean now. I got it to work but the kinematic joint still gives me trouble where the object will drag across the ground and jitter. I think the problem is, it drags and gets a new rotation, and then next frame the target rotation is set, causing a jitter between the two. Is Joint::Vector() able to be moved at all? I know it can be moved around if something hits it, but I want to add forces to it...
-
I've tried this but it doesn't work for me. I'm calling SetTargetPositon() but else where I'm calling AddForce() to the child of that joint to simulate gravity. This seems like it may be bad?
-
Vector seems to constrain the child enity well but setTargetPosition dosnt seem to work and there is no other way to move the joint. ? unless I parent it to another entity maybe, but that might defeat the purpose...
-
So I found this; Joint::Vector(). Anybody have an idea how to use it? It seems to pin the child correctly but I can't get it to move around...
-
Now this looks like somthing I need. ?
Hard to impliment?
-
Awsome! I spent ages looking through those files I'm surprised I missed it. Thanks heaps!
-
If an object has root motion, that means the bones / mesh must move away from the origin point so the character can't be parented to the controller... or you could parent the character to the controller, move the controller forward based on the root motion and move the character entity backwards at the same rate... ? Code to manage this could be written once and then all movements would be controlled via animations. I can see this being good for animals that run around all over the place, but for a character... not sure..
-
I would love to be able to use newton commands directly, such as NewtonWorldRayCast().
Is there a way to get the newton world from within Leadwerks?
-
I think whats happening is the animator will move the root bone in the direction of travel, and then you copy that movement to the character controller. It would take some working out but I don't think it'll be too hard to implement.
QuoteRoot motion is better because it's more realistic, immersive and looks more polished.
That's what I was thinking too.
-
Anyone heard / have thoughts on root motion vs treadmill motion for Leadwerks?
As far as I can tell; Treadmill motion is where you move the characters controller via code at a constant speed, and root motion is where you let the root bone of your animation say how fast and far your controller moves. Just wondering what your thoughts are on both approaches
-
I'm having the same issue, can't test this at the moment but maybe there's a way to update an entities matrix first? Like entity->updatematrix()?
-
You can manipulate vertices quite easily. C++ might be best due to being a bit faster.
-
I've using Leadwerks to design some editor like apps for some other projects. The treeview would make a nice addition to it.
-
So I made the polymesh shape a volume and that still didn't register a trigger event. maybe it doesn't work with polymesh shapes... ?
-
Ah okay. I did find this https://www.leadwerks.com/community/blogs/entry/1760-writing-the-treeview-widget/
Maybe I can flesh it out.
-
As the title says, TreeView.lua is not in the Scripts/GUI folder. Has this been removed for some reason?
-
Isn't it supposed to be self.entity? You are creating a new variable called myEntity and setting it to nil, no where is it being assigned the entity the script belongs too.
Picking Up Objects
in Programming
Posted
You would have to remove the joint. Try this when you click again;
.......... else { heldObjectJoint->Release(); heldObjectJoint = nullptr; heldObject->SetGravityMode(true); heldObject = nullptr; }
I did a quick test and it doesn't delete the child object (heldObject in this case). I'm not sure how it will work though.