• entries
    116
  • comments
    119
  • views
    104856

Let's rock

Sign in to follow this  

1347 views

Hi.
I don't have a lot to show this time. I fixed a few things and added others. Here is the list in no particular order:
- Disable light when linked object is no more active. The bug was visible in the latest video.
- Corrected weapons group activation. In the previous video, a weapon was not shown because the activation was not correct.
- Added guided missile weapon type (for players and enemies).
- Corrected pattern following. The optional pause at any control point was working only when at the first control point.

For the guided missile weapon type, it was not really difficult: in the same manner I have a pool of objects instances for shots, I added a pool of patterns (like the ones used to move objects in the demo menu and enemy ships in the level) consisting of only two control points. The first point is always <0, 0, 0> and when a guided missile is fired, I update the first control point tangent to be the "X" vector of the weapon, the second point to be the position of the target and its tangent to the vector "target - weapon". When the shot object is updated, if it has a target, I keep updating the second point of the pattern to match the relative position of the target. All the movement is done by the existing code for pattern following. The added code is small and it is working quite well.

I also played a bit with Blender. I wanted to rework my rocks. I had a simple way to create one (I may have seen it somewhere but I don't know where) and finally did a small script to generate it automatically. The method is:
- create a cube
- create a plane
- rotate the plane and move it away from the cube centre
- cut the cube with the plane
- repeat with more planes
This is a very basic method but it gives what I need. I added a few things:
- the resulting object is bevelled
- a parameter allows to smooth or not the final object

Here are rocks generated with this method in only one action:
[sharedmedia=gallery:images:7267]

I attached the script if someone is interested. Maybe I will add a UI to set the parameters instead of modifying the values in the file. Just load the file in the text editor of Blender, empty the scene and hit Alt+p.

Have fun.

Sign in to follow this  


2 Comments


Recommended Comments

Nice job on the rock script. It is a lot easier than doing all the slice planes at once.

Share this comment


Link to comment

Thank you.

I noticed a typo in it, the rotation matrices creation should be:

mrwx = Matrix.Rotation(rx, 4, Vector((1, 0, 0)))
mrwz = Matrix.Rotation(rz, 4, Vector((0, 0, 1)))

The vectors are probably normalized before being used but it is better like this.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now