Unreal4 beam particle source location moving with bone/socket - unreal-engine4

I am following this tutorial to create a very simple particle system.https://www.youtube.com/watch?v=hjgnqkLeqf0
Now I want to make the lightning source moving with my character's right hand. There is nothing in parameter instance so I'm guessing I should use blueprint.
Here is my level blueprint and my particle source settings.
What I was trying to do is
I created a socket on skeleton called weapon.
get the socket position in run time every tick.
update particle parameter "lightning source point" vector every tick.
I can see that I get updated socket location from "Get Socket Location" every tick, but my particle source won't move. I also tried add Bone/Socket module in particle cascade but not working(works fine with regular particle but not beam data I guess)

Problem solved by attaching the emitter to the socket in character blueprint, not level blueprint.

Related

How to set the throttle input of a vehicle in UE4 using acceleration/speed data from SUMO?

Hi everyone (and thank you in advance)!
I have successfully connected SUMO into UE4 using network sockets, with the intention of using UE4's superior graphics to run my SUMO simulation. I have managed to get the location, speed, angle, and acceleration (amongst other bits of information) of each of the SUMO vehicles across to UE4, and assigned this information to different vehicles in UE4 (i.e. each SUMO vehicle has a replica in UE4).
I have (I am pretty sure) managed to replicate the steering in SUMO in UE4, and I have managed to ensure that vehicles start at the same location in both programmes, but I am confused as to how I can match the speeds of the vehicles in UE4 and SUMO so that the vehicles are at the same location at the same time (which they need to be as they are turning at the same time).
Unless I have missed something really basic (I may have as I am fairly new to UE4 and SUMO), I don't think that there is a set velocity node for vehicles, whilst I don't think that the "Move to" node works for skeletal meshes. Of course, I could use the "Set Actor Location and Rotation" node, however, for vehicles, I have to teleport the object, which defeats the point of creating a realistic-looking simulation.
So... my question is, in short, "Is there a way of taking a speed/acceleration value and using this value to set the speed a vehicle moves at in UE4?"
I have not found a direct way of setting the velocity of the vehicle actors from SUMO, but a workaround, albeit a slightly annoying solution, is to use static meshes for the vehicles instead. Using the positional "x" and "y" information that SUMO outputs, one can then use the "Move Component To" node in UE4 over time delta (which is the frequency information is sent from SUMO) to get the vehicle static meshes to move in a way that looks similar to how a vehicle would move.

Get Orientation of SCNNode Swift [duplicate]

I am working on a basic racing game using Apple's SceneKit and am running into issues simulating a car. Using the SCNPhysicsVehicle behavior, I am able to properly set up the car and drive it using the documented methods.
However, I am unable to get the car's position. It seems logical that the SCNPhysicsVehicle would move the SCNNodes that contain the chassis and the wheels as the car moves but the SCNNodes remain at their original position and orientation. Strangely enough, the chassis' SCNPhysicsBody's velocity remains accurate throughout the simulation so I can assume that the car's position is based off of the SCNPhysicsBody and not the SCNNode. Unfortunately, there is no documented method that I have found to get an SCNPhysicsBody's position.
Getting a car's position should be trivial and is essential to create a racing game but I can't seem to find any way of getting it. Any thoughts or suggestions would be appreciated.
Scene Kit automatically updates the position of the node that owns an SCNPhysicsBody based on the physics simulation, so SCNNode.position is the right property to look for.
The catch is that there are actually two versions of that node in play. The one you typically access is called the "model" node. It reflects the target values for properties you set, even if you set those properties through an animation. The presentationNode reflects the state of the node currently being rendered — if an animation is in progress, the node's properties have intermediate values, not the target values of the animation.
Actions, physics, constraints, and any scene graph changes you make inside update/render loop methods directly target the "presentation" version of your scene graph. So, to read node properties that have been set by the physics simulation, get the presentationNode for the node you're interested in (the node that owns the vehicle's chassisBody physics body), then read the presentation node's position (or other properties).
I have the same problem with my player node.
I move it with applyForce (to manage collision detection).
But when i check node position after some movement, the node position has not move (presentation node is the actual position as rickster write in his answer)
I manage to update the scnNode.position with renderer loop
You have to set position of your node with the presentationNode position.
node.position = node.presentationNode.position
Set this into renderer(_: updateAtTime) and your node position will sync with any animation you made to the physicsBody

Empty Sweep Hit Result On Overlap with projectile

I'm trying to make a projectile shooting system, but the Sweep Result is empty. I need it to see whether or not the projectile hit the bone 'head' and to see the hit location.
I made sure that I have a sweep collision on the projectile movement and the character movement.
Here is the overlapping event with the server event handling the ProjectileDamage:
https://blueprintue.com/blueprint/v9gzb-uf/
(Scroll up to see the OnComponentBeginOverlap Event)
The actual system works, but the sweep result is empty.
Thank you in advance
Physics or Projectile Movement
Use OnComponentHit, not OnComponentBeginOverlap, if using physics or a projectile movement component.
OnComponentHit
Event called when a component hits (or is hit by) something solid. This could happen due to things like Character movement, using Set Location with 'sweep' enabled, or physics simulation. For events when objects overlap (e.g. walking into a trigger) see the 'Overlap' event.
For collisions during physics simulation to generate hit events, 'Simulation Generates Hit Events' must be enabled for this component.
When receiving a hit from another object's movement, the directions of 'Hit.Normal' and 'Hit.ImpactNormal' will be adjusted to indicate force from the other object against this object.
NormalImpulse will be filled in for physics-simulating bodies, but will be zero for swept-component blocking collisions.
OnComponentBeginOverlap
Event called when something starts to overlaps this component, for example a player walking into a trigger. For events when objects have a blocking collision, for example a player hitting a wall, see 'Hit' events.
Projectile Movement
If using Projectile Movement Component, you can also use OnProjectileStop event.
Verify hit is impacting a skeletal mesh
You'll only get a Bone Name in the hit result if you are impacting a skeletal mesh.
Example Project
To see an example of a physics impact and a projectile movement impact hitting a skeletal mesh and returning a bone name, see this example project.
I now figured out how to fix my issue.
I just had to set the the object type, from the character, from 'Pawn' to World Dynamic. Now the projectile also has a Hit Result.

Modeling a floor/ground for a walking robot in Simulink

I'm trying to create a simple model of a body which will then be later controlled. However, I am running into trouble when I'm connecting both legs to the body.
What I have done is that I have built the model starting with the left foot, attached to the world frame, and then up to the torso. I ended up duplicating one of the legs and attached it again the the world frame and the torso, effectively closing the "loop". However, I get the following error message when trying to run the simulation.
'untitled/Right Leg/Hip/Revolute Joint' has a degenerate mass distribution on its follower side.
I have a feeling this has to do with the fact that both legs are attached to the torso and to the world frame.
If I let the legs dangle from the torso by attaching the torso to the world frame directly, then it works. But I need the legs to be attached to a "ground/floor"
What would be the correct way to model this so that I can later actuate the joints?
I believe you need three connections between your robot and the floor:
A contact force between the left foot and the floor
A contact force between the right foot and the floor
A virtual connection that lets you specify the initial height of the torso above the floor.
The virtual connection to specify the initial height above the floor is usually done with a 6-DOF Joint. It doesn't constrain anything, but lets you specify initial position, orientations, and velocity of the torso.
The contact force can be done with a hard stop, but I would recommend you look at this library on the MATLAB Central File Exchange:
https://www.mathworks.com/matlabcentral/fileexchange/47417-simscape-multibody-contact-forces-library
This will allow you to model contact between the feet and the floor, as well as friction which will enable the robot to walk. The force you need is the Face to Plane contact force.
Give it a try and see what you think.
--Steve

Positioning particles and life span of particle system in AndEngine GLES2

I am using particle system in my game, in andEngine GLES2, to produce a glittering effect.
I could not find a way to position particles after these are attached to the scene(run time).
Secondly i want to know if there is a way to make a check on the particles movement like listener in animations because I want to stop particles to emit after they expire first time.
Any help in this regard will be much appreciated.
First positioning particle system, There is a method setCenter that you can use in following manner.
particleEmitter.setCenter(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
Also you can see basic andengine example to clear your concept.
Second stop particle system, As per my consideration there is no listener for particle system. So to satisfy you need you have to think differently. You have to use TimerHandler to satisfy your need. When first time onTimer method of TimerHandler gets executed at that time you have to detach particle system or whatever you want to do.
if you want to move particles in different directions then add
new VelocityParticleInitializer<Sprite>(30,-42, -40, 40)
to the partial system.
Example:
systemBallParticleSystem.addParticleInitializer(new VelocityParticleInitializer<Sprite>(30,-42, -40, 40));
Second point
when partical effect started register a delay modifier and detach your system after that time
Example:
registerEntityModifier(new DelayModifier(pDuration, pEntityModifierListener));
in this pEntityModifierListener you can detach your partical system