I'm building a game with Cocos2d + Box2d
I want my hero's jump direction to be
orthogonal to the ground he is standing on.
My idea is that I use a vector from the contact point
(hero with ground) to the Center of the Hero Sprite.
Then I use an impulse to make the hero jump.
Has anyone an idea how I could do this?
How can I find out the contact point?
Related
I am making in Game Maker where you are a ship. You stay in the middle of the screen while the stars would move around you, giving the illusion of movement.
So far the spaceship rotates to follow the mouse and when you press the space bar the stars are given the direction and velocity that the ship should have and it is applied to the star.
The mechanic i'm struggling with is generation the stars randomly as you 'move'. It would need to seem as if you were travelling through space and could relocate the same star generation if you flew back to it.
If anyone has any ideas, that would be highly appreciated.
you could use a random_range() for the star creation, but for having them stay in place forever its a little hard, maybe you could make only 1 room for everything and make a function that only fill the rooms with stars and starts on create (and then deactivate forever) then save the state of the room and voila (idk if im being clear)
I'm using A-Frame and I'd like to know if there's a component or a way to smoothly rotate from current direction towards another over a few secs. I plan to use this with the alongpath component just before playing the movement on my camera. Thanks!
I'm using Unity 5.4.f1 and I'm trying to make make a water similar to Where's My Water using particles...
The main issue I have is creating the white outline on particles:
Does anyone have experience with this or perhaps a link that might point me in the right direction? I have my particles blue and reacting nicely together in terms of movement, it's just the white outline that I can't seem to work out right now.
Thanks
I don't know how to explain this but the objects I make in ELEMENT 3D aren't 3D but more like 2.5D.
I made a video so you can see the problem.
https://sendvid.com/s1hv1ay3
My recording software didn't record the Element interface at 0:24, but I was trying to show in that interface that you could rotate it without problems.
You're not understanding how Element3D (and aspects of the AE interface) work. Think of the layer you apply it to as being its own window "into a 3D world". You don't rotate the layer itself, you rotate the objects within the Element3D world by changing the parameters in the timeline or Effects controls pane. You were using the rotate tool in the video with the Element3D-effected layer selected. Don't do that. Use the individual parameters within Element. Another way to rotate around the 3D object(s) is to use the camera. I suspect this is what you were attempting after seeing a tutorial or something. What you do is make a two-node camera and use the camera tool by cycling through the tool with the "c" key until you get camera rotate, which looks a bit similar to the rotate layer tool. With a two-node camera, rotating the camera allows you to rotate around the point of interest of the camera so it rotates around the object in 3D space. I suggest you get a more familiar with how 3D works in AE (which is not "true 3D", not 2.5D, but is "Planar 3D"; the Element3D plugin is one of the best 3D-integrated plugins working within this model).
don't ever move the layer the element 3d model is on.
Use the element effects controls (f3). usually found in group 1
I've been working on a little space simulator demo using three.js and flightcontrols.js (an example that ships with three.js)
The demo is viewable at - http://www.zacharycarter.com/PrivateerRedux/demo.html
The control scheme is pretty simple - the mouse controls the camera and you left click to fire a projectile.
I'm having a little bit of trouble with how I'm spawning my projectiles. Currently I'm setting their rotation to the same rotation of my camera which I believe is what is causing my problems.
You'll notice that as you rotate the camera around the game world, and continue firing projectiles, that the position and orientation of the projectiles quickly becomes whacky.
I'm using quaternions to represent my camera's rotation but I also derrive the Euler angles from the quaternion before setting my projectiles rotation to match that of my cameras.
Any ideas as to what I'm doing wrong here? I have a feeling I need to figure out a constant front facing rotation from my camera rotation but I'm not quite sure how to do that.
Thanks!
If I understand this correctly, I think your problem is that you're applying world transformations and local transformations (i.e rotation in world space to have bullets fly in the right direction and rotation of bullets around the bullets' local axes) incorrectly. It seems they're all being applied in the same space.
Instead of writing up a whole new example, however, I'll leave it to the old, trusty internet to hand us some guidance on the issue using the common example of a solar system.
This might enlighten you:
http://docs.techsoft3d.com/visualize/3df/latest/Hoops3DGS/prog_guide/03_3_viewing_modelling_matrices.html
(have a look at figure 3.3.2.b)
...and here's an OpenGL example demonstrating the same thing:
http://www.codemiles.com/c-opengl-examples/solar-system-transformations-t7292.html
There's the theory anyway, hope that helps!